Back to Gogs

Localization

docs/advancing/localization.mdx

0.14.22.9 KB
Original Source

Gogs has supported multiple languages since release v0.5.0. Users can change the interface language instantly with a single click from their settings page.

Configuration

Available languages are configured in custom/conf/app.ini under the [i18n] section. All supported languages are enabled by default:

ini
[i18n]
LANGS = en-US,zh-CN,zh-HK,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT
NAMES = English,简体中文,繁體中文,Deutsch,Français,Nederlands,Latviešu,Русский,日本語,Español,Português do Brasil,Polski,български,Italiano
OptionDescription
LANGSA comma-separated list of locale codes to enable. Each entry corresponds to a locale file.
NAMESA comma-separated list of display names for each language, in the same order as LANGS.
<Tip> To restrict the available languages, simply remove entries from both `LANGS` and `NAMES`. Make sure the two lists remain in the same order and have the same number of entries. </Tip>

Contributing translations

Translations are managed through Crowdin. To contribute:

<Steps> <Step title="Sign up"> Create an account on the [Gogs Crowdin project](https://crowdin.gogs.io/). </Step> <Step title="Translate"> Browse the available strings and fill in untranslated entries for your language. </Step> <Step title="Review"> Review existing translations and suggest improvements where needed. </Step> </Steps> <Info> When translating, focus on conveying the meaning rather than producing a literal word-for-word translation. It is more important that the translation reads naturally in your language than that it matches the exact words of the English version. </Info>

Making corrections

If you find an incorrectly translated string, you can search for it efficiently on Crowdin by using its key name rather than the translated text.

For example:

  • To fix the translation for "Home", search for the key home instead of searching for the word "Home".
  • For keys under a section, search using the format section:key_name, such as home:uname_holder.

Testing translations locally

If you want to test your translation without making changes to your Git history, place your locale file into:

custom/conf/locale/<file>

Then restart Gogs to load the updated translations.

Custom locale files

If you are not satisfied with the official translation for your language, you can override individual fields by creating a custom locale file:

custom/conf/locale/locale_<lang>.ini

For example, to override specific English strings, create custom/conf/locale/locale_en-US.ini and add only the keys you want to change. Restart Gogs to apply the changes.

<Note> Custom locale files only need to contain the keys you want to override, not the entire locale file. Unspecified keys will fall back to the official translation. </Note>