Move all strings from Kotlin files to strings.xml for Localization
- Dominant language
- Kotlin
- Stars
- 3
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
## Description
Currently, some of the app's UI strings are hardcoded directly into Kotlin (`.kt`) files. To enhance the app's localization capabilities and make it easier to manage translations, we need to migrate all hardcoded strings into the `strings.xml` file. This will allow us to support multiple languages without changing the codebase and improve the maintainability of the application.
### Tasks:
1. Identify all hardcoded strings in the Kotlin files (`.kt`).
2. Move those strings to the `strings.xml` resource file under the appropriate `` tags.
3. Replace the hardcoded strings in the Kotlin files with references to the corresponding string resources.
4. Ensure that the application works correctly after the migration and all strings are properly localized.
## Example
This is in `Mess.kt` line : 217 - 226
### Before:
```kotlin
// Hardcoded string in Kotlin file
if (!yearSelected) {
toast("Please Select a year")
} else if (!genderSelected) {
toast("Please Select gender")
} else if (!batchSelected) {
toast("Please Select a batch")
} else {
onResult(target)
dialog.dismiss()
}
```
### After:
1. Add strings to `res/values/strings.xml`:
```xml
Please Select a year
Please Select gender
Please Select a batch
```
2. Modify Kotlin code to reference the string resources:
```kotlin
// Using string resource from strings.xml
if (!yearSelected) {
toast(getString(R.string.select_year))
} else if (!genderSelected) {
toast(getString(R.string.select_gender)
} else if (!batchSelected) {
toast(getString(R.string.select_batch)
} else {
onResult(target)
dialog.dismiss()
}
```
## Expected Outcome
- All hardcoded strings in `.kt` files are moved to `strings.xml`.
- The app continues to work seamlessly with localized strings.
- The code is cleaner and easier to maintain.
Create single PR per file.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.