docs/l10n.md
Git LFS now has support for a localization framework using Gotext, a Go library based around the popular gettext format. Localization is important since the majority of people on the planet don't speak English and people should be able to use software in the language they're most comfortable with. In addition, having access to localized software is a great way for people learning a language to improve their technical vocabulary.
Here are some things that should be translated:
Here are some things that should not be translated:
tracerx.Printf)Basic and other authentication schemes, HTTP verbs)The easiest way to make a string translatable is to wrap the string and any formatting arguments it takes in a call to tr.Tr.Get.
For example, you might write this:
Print(tr.Tr.Get("Fetching reference %s", ref.Name))
If you have a string which varies based on a number, use tr.Tr.GetN, provide the singular string, the plural string, the number upon which it varies, and then the arguments:
Print(tr.Tr.GetN(
"Fetching changes within %v day of %v",
"Fetching changes within %v days of %v",
fetchconf.FetchRecentCommitsDays,
fetchconf.FetchRecentCommitsDays,
refName,
))
Here are some tips for making your code as easy to translate as possible:
tr.Tr.GetN, which handles pluralization correctly.
In some languages, zero is singular instead of plural. Also, unlike English, some languages have more than just two forms of a word (e.g., singular, dual, and plural), or words may not vary in number at all.
This also lets users in English see correctly pluralized strings in all cases.xgotext binary rips out only literal strings and doesn't handle variables, so strings that are not marked for translation at the same place they appear in the text won't end up in the translation files to be translated.If you're interested in submitting a translation, please open an issue, and we'll work with you to get what you need. We'll let you know a little in advance of our next planned release to give you time to update the translations.
When choosing to create a translation, we ask that you write a generic translation when possible (e.g., es rather than es_MX).
We realize that is not always achievable (such as with pt_BR and pt_PT), but when possible, it makes the translations more accessible.
For vocabulary, we recommend using the same rules as Git whenever possible. If there's a decision to be made, picking the more universally intelligible option (e.g., quatre-vingts instead of huitante in French or ustedes instead of vosotros in Spanish) is preferable. We'll generally defer to your experience on these matters.
To extract the strings for translation, run the following commands:
$ go install -v github.com/leonelquinteros/gotext/cli/xgotext
$ xgotext -in . -out po -v
Be aware that at the moment, xgotext is extremely slow.
You may wish to get a coffee while you wait.
If you're unclear on the best way to do things or you find a problem, feel free to open an issue or discussion, as appropriate, and we'll be happy to work with you to find a solution.