Skip to content
Snippets Groups Projects
README.md 6.56 KiB
Newer Older
  • Learn to ignore specific revisions
  • Erica Xu's avatar
    Erica Xu committed
    # Translate Obsidian
    
    
    Erica Xu's avatar
    Erica Xu committed
    Help translate Obsidian into your language.
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    Erica Xu's avatar
    Erica Xu committed
    ## Add a new language
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    Erica Xu's avatar
    Erica Xu committed
    To add a new language, follow these steps:
    
    1. Copy all of the content of the raw `en.json`: https://raw.githubusercontent.com/obsidianmd/obsidian-translations/master/en.json
    2. Paste into here: https://github.com/obsidianmd/obsidian-translations/new/master
    3. Translate some strings to your language
    
    4. Find the language code of the language you're contributing: https://www.wikiwand.com/en/List_of_ISO_639-1_codes and name the new file `[language code].json`.
    6. In the description of the pull request, or in a comment, please include the [endonym](<https://en.wikipedia.org/wiki/Endonym_and_exonym#:~:text=An%20endonym%20(also%20known%20as,their%20homeland%2C%20or%20their%20language.>) of the language, this is how the language will be displayed in the app.
    7. Submit your pull request.
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    Erica Xu's avatar
    Erica Xu committed
    ## Staying up-to-date
    
    
    Merge conflicts are nasty. They happen when you're translating an outdated version of the template, part of which might have been translated by someone else. To prevent this, try to fork our repository right before you translate.
    
    Erica Xu's avatar
    Erica Xu committed
    
    If you want to do multiple translation pull requests, before doing work each time, use the "Compare" UI on your own fork to pull in all the newest changes from `obsidianmd:master` first by creating a pull request on your own repository and merge it in yourself, so that your own copy is up-to-update.
    
    
    Erica Xu's avatar
    Erica Xu committed
    ## Submit changes
    
    Erica Xu's avatar
    Erica Xu committed
    
    To translate, [fork this repo](https://guides.github.com/activities/forking/) and edit the JSON file of your language. After that, [submit a pull request](https://guides.github.com/activities/forking/).
    
    Note that you don't have to clone your fork to make the edits; you can do everything on GitHub's web UI. Simply open a file in your own forked repo and click on the pencil icon to start editing.
    
    
    Erica Xu's avatar
    Erica Xu committed
    ## Translating
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    The translation JSON file consists of key-value pairs. The key should give you a good idea of where the text is in the app.
    
    Erica Xu's avatar
    Erica Xu committed
    
    To translate, simply edit the value. For example, let's say you see
    
    ```json
    "plugin": "Plugin"
    ```
    
    Simply change it to:
    
    ```json
    "plugin": "pLU9IN"
    ```
    
    where "pLU9IN" is the phrase "plugin" in the target language. I'm using leetspeak as an example here.
    
    If you encounter something like
    
    ```json
    "label-welcome": "Welcome, {{name}}!"
    ```
    
    Erica Xu's avatar
    Erica Xu committed
    leave the `{{name}}` part alone and do not translate it. "name" is not part of the text and will be replaced by the appropriate value when the app runs.
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    Erica Xu's avatar
    Erica Xu committed
    ### Translating an update
    
    From time to time, we'll add new strings to all the language files. The new strings will be in English and ready to be translated to your language of choice.
    
    Update commits usually have message in the format of "Update strings for 1.x.x" where "1.x.x" is the new version number. This is an example commit: [Update strings for 1.2.7](https://github.com/obsidianmd/obsidian-translations/commit/8bff16a8b866604876d417bf7f322484b6090431).
    
    By examining what happened to your language file, you can find the new strings to translate.
    
    ### Translate a missing phrase on the UI
    
    If you spot a missing phrase while using Obsidian, here's what to do:
    
    1. Figure out where the language file lives by looking up the language table in the README under the ["Existing languages" section](https://github.com/obsidianmd/obsidian-translations#existing-languages).
    2. Edit the language file, look for the exact English phrase.
    3. Replace it with the appropriate translated phrase.
    
    4. Submit your changes as a pull request.
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    ### Testing translation
    
    Once you have the JSON file, you can test it by opening up developer console and enter `selectLanguageFileLocation()`. The app will prompt you for a JSON file location. After that, the app will reboot itself with the selected translation JSON file applied.
    
    To revert to using the default language pack, open developer console and enter `localStorage.removeItem('language')`.
    
    
    Erica Xu's avatar
    Erica Xu committed
    ## Existing languages
    
    
    Erica Xu's avatar
    Erica Xu committed
    Here is a table of language code to language name, in alphabetical order. These languages have their template files ready, but are not necessarily ready to be used in the app.
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    Erica Xu's avatar
    Erica Xu committed
    | Language code | Language name | Native name | Status |
    
    Erica Xu's avatar
    Erica Xu committed
    | --- | --- | --- | :---: |
    
    Erica Xu's avatar
    Erica Xu committed
    | `en` (default) | English | English | ✅ |
    
    | `af` | Afrikaans | Afrikaans | 🚧 |
    
    | `am` | Amharic |  አማርኛ | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `ar` | Arabic | العربية | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `eu` | Basque | Euskara | 🚧 |
    
    | `be` | Belarusian | беларуская мова | ✅ |
    
    | `bg` | Bulgarian | български език | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `bn` | Bengali | বাংলা | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `ca` | Catalan | català | 🚧 |
    
    | `cs` | Czech | čeština | 🚧 |
    
    | `da` | Danish | Dansk | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `de` | German | Deutsch | ✅ |
    
    | `dv` | Dhivehi | ދިވެހި | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `el` | Greek | Ελληνικά | 🚧 |
    
    | `en-GB` | English (GB) | English (GB) | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `eo` | Esperanto | Esperanto | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `es` | Spanish | Español | ✅ |
    
    | `fa` | Persian | فارسی | 🚧 |
    
    Liam Cain's avatar
    Liam Cain committed
    | `fi-fi` | Finnish | suomi | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `fr` | French | français | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `gl` | Galician  | Galego | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `he` | Hebrew  | עברית 🇮🇱 | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `hi` | Hindi | हिन्दी | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `hu` | Hungarian | Magyar nyelv | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `id` | Indonesian | Bahasa Indonesia | ✅ |
    
    | `it` | Italian | Italiano | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `ja` | Japanese | 日本語 | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `ko` | Korean | 한국어 | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `lv` | Latvian | Latviešu valoda | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `ml` | Malayalam | മലയാളം | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `ms` | Malay | Bahasa Melayu | 🚧 |
    
    | `ne` | Nepali | नेपाली | ✅ |
    
    | `nl` | Dutch | Nederlands | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `no` | Norwegian | Norsk | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `oc` | Occitan | Occitan | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `pl` | Polish | język polski | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `pt` | Portuguese | Português | ✅ |
    | `pt-BR` | Brazilian Portuguese | Portugues do Brasil | ✅ |
    
    | `ro` | Romanian | Română | 🚧 |
    
    Johnny Utah's avatar
    Johnny Utah committed
    | `ru` | Russian | Русский | ✅ |
    
    | `sa` | Sanskrit | संस्कृतम् | 🚧 |
    
    | `sr` | Serbian | српски језик | 🚧 |
    
    | `sv` | Swedish | Svenska | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `sk` | Slovak | Slovenčina | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `sq` | Albanian | Shqip | ✅ |
    
    | `ta` | Tamil | தமிழ் | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `te` | Telugu | తెలుగు | 🚧 |
    
    | `th` | Thai | ไทย | ✅ |
    
    | `tl` | Filipino (Tagalog) | Tagalog | 🚧 |
    
    | `tr` | Turkish | Türkçe | ✅ |
    
    | `uk` | Ukrainian | Українська | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `ur` | Urdu | اردو | 🚧 |
    
    Erica Xu's avatar
    Erica Xu committed
    | `vi` | Vietnamese | Tiếng Việt | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `zh` (see note below) | Chinese (Simplified) | 简体中文 | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    | `zh-TW` | Chinese (Traditional) | 繁體中文 | ✅ |
    
    Erica Xu's avatar
    Erica Xu committed
    
    
    Ryooo's avatar
    Ryooo committed
    > Note: the Chinese translation is maintained by Obsidian.zh. If you want to discuss it, please come here: https://github.com/obsidianzh/obsidian-translations.