Skip to content

Commit

Permalink
translate all texts blog
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuljeet1998 committed Oct 22, 2024
1 parent 4655620 commit 7d2ddbc
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
76 changes: 76 additions & 0 deletions pages/blogs/20241021-smoother-translate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# A Guide to find and translate texts to supported languages

October 21, 2024 • [Kuljeet1998](https://github.com/Kuljeet1998/)

## Introduction

Language translation plays a crucial role in enhancing the user experience on myPlanet, which is used in diverse regions like Mexico, Nepal, Kenya, Ghana, and Somalia. To ensure effective navigation and comprehension, myPlanet supports multiple languages, including English, Arabic, Spanish, French, Nepali, and Somali. Providing complete translation throughout the app allows users to fully engage with its features, enabling them to maximize the app's potential and benefit from its resources.


## Finding non-translated texts: Tips & Tricks

1. **While testing the app**:

- When testing the app’s overall flow, ensure you check all tabs and features in different languages, as some may be overlooked.
- If you find any untranslated sections, create an issue and resolve it. (Easy 2 points).

2. **While reviewing PRs**:

- You might encounter untranslated text when reviewing PRs.
- Expand all the modified files.
- Pay close attention to any text that remains in English and isn’t referenced from `@strings/...`

![Files changed](images/20241021-review-pr.png)

3. **While solving a different issue**:

- You might encounter untranslated text when you are solving an issue assigned to you.
- While working on different issues, you tend to explore the codebase more. This is when you might come across more untranslated texts.
- Pay close attention to any text that remains in English and isn’t referenced from `@strings/...`
- If you find it - easy 2 points!


## Leveraging ChatGPT to translate the texts

1. **Prompt to train texts in the supported languages**:

- Type in:
```
Translate the following text in these languages:
1. English
2. Arabic
3. Espanol
4. francias
5. nepali
6. somalian
```
- Simply enter the text to be translated in double quotes (e.g., "mark all as read").
- Watch the magic happen!

![ChatGPT snapshot](images/20241021-translate-text-chatgpt-snapshot.png)

TIP:
Rename this ChatGPT tab for easier access (e.g., !! TRANSLATE !!).

![ChatGPT tab](images/20241021-translate-tab-chatgpt.png)



## Make the changes in codebase

1. **Add the translated texts to respective files**:
- Copy and paste the translated text into the appropriate XML files.
- For example, add `<string name="mark_all_as_read">Marcar todo como leído</string>` to `es/strings.xml`.
- Replace the source text `"Mark all as read"` with `"@string/mark_all_as_read"`.
- Repeat this process for the XML files of all supported languages.

2. **Build and test**:
- Build the app.
- Go to the screen where the changes should appear.
- Switch between languages to verify that everything works as expected.

3. **Commit, Push, Create PR**:
- Stage all changes.
- Commit with an appropriate message.
- Push to GitHub.
- Create a pull request.
1 change: 1 addition & 0 deletions pages/blogs/blog-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
[Reading Error Logs](20240819-error-log.md) on August 19, 2024 by rlam20 `(Reading the error logs to resolve crashes)`
[Language Support in Android](20240816-language.md) on August 16, 2024, by rlam20 `(How to support different languages in Android)`
[Android Debugger](20240805-android-debugger.md) on August 5, 2024 by ewhang5 `(Utilizing the Android Studio Debugger to Solve Bugs)`
[Translate texts](20241021-smoother-translate.md) on October 21, 2024 by Kuljeet1998 `(How to translate texts into all languages)`
Binary file added pages/blogs/images/20241021-review-pr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7d2ddbc

Please sign in to comment.