|
| 1 | +# Translations |
| 2 | + |
| 3 | +All string resources in FirebaseUI are translated into a number of locales. The |
| 4 | +translation process leverages Google's internal translation pipeline, so the |
| 5 | +commands listed in this document are google specific. |
| 6 | + |
| 7 | +The translation process has a few basic steps: |
| 8 | + |
| 9 | + 1. Export strings from the git project |
| 10 | + 1. Create a CL with the exported strings |
| 11 | + 1. Kick off translation by requesting "extraction" |
| 12 | + 1. Wait ~1 week for strings to be translated |
| 13 | + 1. Finish translation by requesting a "dump" |
| 14 | + 1. Export the dumped strings |
| 15 | + 1. Import the dumped strings, and clean them up |
| 16 | + |
| 17 | +## 1 - Export Strings |
| 18 | + |
| 19 | +From the project root, run: |
| 20 | + |
| 21 | +```shell |
| 22 | +# This command will output to the console, you probably want to redirect |
| 23 | +# it to some temporary file. |
| 24 | +python ./scripts/translations/export_translations.py |
| 25 | +``` |
| 26 | + |
| 27 | +This will take the `strings.xml` file from the `auth` module and get it |
| 28 | +ready to be sent off for translation. Thist mostly consists of stripping |
| 29 | +the `fui_` prefixes. |
| 30 | + |
| 31 | +## 2 - Create a CL |
| 32 | + |
| 33 | +Overwrite the following file with the output from the previous step: |
| 34 | + |
| 35 | +``` |
| 36 | +google3/firebase/auth/ui/android/src/main/res/values/strings.xml |
| 37 | +``` |
| 38 | + |
| 39 | +## 3 - Request Extraction |
| 40 | + |
| 41 | +In the Translations Console (tc/) go to the **FirebaseUI** project and |
| 42 | +click **Extract Source Messages**. |
| 43 | + |
| 44 | +## 4 - Wait |
| 45 | + |
| 46 | +Get a snack. Probably a few. You can check translation percentage in the |
| 47 | +console. |
| 48 | + |
| 49 | +## 5 - Request Dump |
| 50 | + |
| 51 | +This is the same as step 3, but click **Dump Translations**. Make sure all |
| 52 | +translations are 100% completed before doing this. |
| 53 | + |
| 54 | +## 6 - Export Strings |
| 55 | + |
| 56 | +In order to build out the `xml` files you'll need, run: |
| 57 | + |
| 58 | +```shell |
| 59 | +blaze build firebase/auth/ui/android:translated_messages |
| 60 | +``` |
| 61 | + |
| 62 | +## 7 - Import and Cleanup Strings |
| 63 | + |
| 64 | +First, copy the strings you just built back into the project: |
| 65 | + |
| 66 | +```shell |
| 67 | +cp -r blaze-genfiles/firebase/auth/ui/android/src/main/res/values* $FBUI/auth/src/main/res/ |
| 68 | +``` |
| 69 | + |
| 70 | +Second, in Android studio right-click on the folder containing all the |
| 71 | +auth `values` XML files and click **Reformat Code**. I don't know of any |
| 72 | +way to run an equivalent formatter at the command line. |
| 73 | + |
| 74 | +Third, run the following from your project root: |
| 75 | + |
| 76 | +``` |
| 77 | +/scripts/translations/clean_up_translations.sh |
| 78 | +``` |
0 commit comments