-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Localization Process
The following document gives a step by step guide for the string localization process. This process has a lot of quirks: it is a work in progress - both this document and the process itself.
This following repos are the required to run the localization process.
- firefoxios-l10n - Github Link - you'll need both the repo as well as your own fork of this repo
- LocalizationTools - Github Link
- Firefox iOS - Github Link
A note on this process. If you run sh ./bootstrap.sh --importLocales
this will bootstrap the main Firefox-iOS repo and also download the localization tools and l10n repo in the firefox-ios
folder and you don't have to do it manually.
You can also do this manually, of course. Either way, note the location of the l10n repo as you will need it later.
- Pull
firefoxios-l10n
somaster
is up to date - Create separate branch off
main
infirefox-ios
- Import strings
- Make a PR to
main
and merge when approved - Create a new branch from
main
and add new strings - Export
- Make a PR to
master
infirefox-l10n
from your fork - Admin will merge
- Wait for translations to come in and be notified
- Pull
master
from `firefoxios-l10n' - In your string branch on the
firefox-ios
repo, do an import - Make a PR to
main
Now that you have everything you need, here are the steps you need to take for localization.
- When you begin the process always pull the latest
firefoxios-l10n master
branch. This ensures that you have the latest strings from translators before you do an export and prevents discrepancies when we're exporting. - Open the
LocalizationTools
project. If you have an error, you might need to adjust theswift-tools-version
, located inPackage.swift
. Either upgrade or downgrade it depending on yourswift-tools-version
. As of Sep 2021,5.4
will work fine. - Now, click
Edit scheme
and select theRun
scheme. - Add arguments to the scheme to configure what you're doing
--project-path <project-path>
Sets the project path tofirefox-ios
. This should point to wherever yourClient.xcodeproj
is, and specify the project file in the path as well.--l10n-project-path <l10n-project-path>
Sets the path to thefirefoxios-l10n
repo.--export/import
Depending on whether you want to run an export/import task--version
show the version--help
show help information
Note: Even if your goal is to export, you still need to import first. This ensure that string translation fixes for existing strings are present during the export.
After setting the arguments above, let it run with the --import
argument. Importing will take a while. Be aware that you'll see lots of errors & warnings in the console. You can ignore these - it won't affect your import process.
After the process is complete, you'll see a list of files modified in your firefox-ios
repo. If your goal was to import newly available/translated strings, you can commit the necessary files and create a PR on firefox-ios
.
One reason this may be happening is because of how Xcode is named on your system. If you have multiple versions of Xcode, you may have named them Xcode 13.0
, Xcode 12.4
etc. In the logs, look for:
/Applications/Xcode 13.0.app/Contents/Developer/usr/bin/xcodebuild -importLocalizations -project ...```
The Xcode part of the command line invocation, in this example, should be `/Applications/Xcode\ 13.0.app/...` but it seems that it doesn't get called correctly. You must rename your Xcode, in this situation, to not have a space - `Xcode13.0` in this example. This should fix the problem and allow you to import successfully.
## Exports
_Note: Imports need to happen before you do an export! Follow the process above and come back here after._
* Be sure that new string comments are understandable to localizers. Make sure comments are descriptive and don't rely on knowing the context of the new string.
* Here, we'll switch to the `--export` argument
* Importing will result in changes in `firefox-ios`. Exporting will result in changes in `firefoxios-l10n`.
* Each locale modification will need a separate commit. You can use this bash script (for now)
```bash
#! /usr/bin/env bash
locale_list=$(find . -mindepth 1 -maxdepth 1 -type d \( ! -iname ".*" \) | sed 's|^\./||g' | sort)
for locale in ${locale_list};
do
git add ${locale}/${l10n_file}
git commit -m "${locale}: Update ${l10n_file}"
done
- Push your branch to your fork
- Make a PR to FireFoxiOS-l10n repo
master
- Once the PR has been approved, merge
- Once we are notified that the strings have been translated, we'll have to do another import on a branch off of
main
in thefirefox-ios
repo - Make a PR and double check that everything shows up correctly
You have now achieved expert level status on String Localization. Rejoice. Celebrate! Do a victory dance!!!
Ahh, you're back. I expected you. L10N team gave you some edits and you're wondering what's the best way to fix and push? The gist is that you have to redo the export process and force push. Here are steps:
- Find the last commit on
master
before all your commits were added. - To delete commits up to that commit, run
git reset --hard <commit-hash>
. - With your fixes now ready, run the export and the bash script again.
- Force push to your branch.
Notify the L10N team about updates!