1
0

localization.mdx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ---
  2. title: "Localization"
  3. description: "Configure interface languages and contribute translations to Gogs"
  4. icon: "language"
  5. ---
  6. 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.
  7. ## Configuration
  8. Available languages are configured in `custom/conf/app.ini` under the `[i18n]` section. All supported languages are enabled by default:
  9. ```ini
  10. [i18n]
  11. 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
  12. NAMES = English,简体中文,繁體中文,Deutsch,Français,Nederlands,Latviešu,Русский,日本語,Español,Português do Brasil,Polski,български,Italiano
  13. ```
  14. | Option | Description |
  15. |---|---|
  16. | `LANGS` | A comma-separated list of locale codes to enable. Each entry corresponds to a locale file. |
  17. | `NAMES` | A comma-separated list of display names for each language, in the same order as `LANGS`. |
  18. <Tip>
  19. 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.
  20. </Tip>
  21. ## Contributing translations
  22. Translations are managed through Crowdin. To contribute:
  23. <Steps>
  24. <Step title="Sign up">
  25. Create an account on the [Gogs Crowdin project](https://crowdin.gogs.io/).
  26. </Step>
  27. <Step title="Translate">
  28. Browse the available strings and fill in untranslated entries for your language.
  29. </Step>
  30. <Step title="Review">
  31. Review existing translations and suggest improvements where needed.
  32. </Step>
  33. </Steps>
  34. <Info>
  35. 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.
  36. </Info>
  37. ### Making corrections
  38. If you find an incorrectly translated string, you can search for it efficiently on [Crowdin](https://crowdin.gogs.io/) by using its **key name** rather than the translated text.
  39. For example:
  40. - To fix the translation for "Home", search for the key `home` instead of searching for the word "Home".
  41. - For keys under a section, search using the format `section:key_name`, such as `home:uname_holder`.
  42. ### Testing translations locally
  43. If you want to test your translation without making changes to your Git history, place your locale file into:
  44. ```
  45. custom/conf/locale/<file>
  46. ```
  47. Then restart Gogs to load the updated translations.
  48. ## Custom locale files
  49. If you are not satisfied with the official translation for your language, you can override individual fields by creating a custom locale file:
  50. ```
  51. custom/conf/locale/locale_<lang>.ini
  52. ```
  53. 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.
  54. <Note>
  55. 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.
  56. </Note>