Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate all texts blog #3456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.