Adapting IPFS apps and websites for a specific language by translating text and adding locale-specific components
Go to https://www.transifex.com/ipfs/public/, select languages you want to help with and start translating!
Transifex is localization platform for crowdsourcing translations from IPFS Community:
- Everyone can contribute translations.
- Be sure to change your Transifex notification settings to be notified when translation sources change.
- Missing language? Request it via Transifex UI
- Night Owl? Try Dark Mode 🦉
That is all!
Continue reading!
Internationalization (I18N) is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes.
Localization (L10N) is the process of adapting internationalized software for a specific region or language by translating text and adding locale-specific components.
Localization (which is potentially performed multiple times, for different locales) uses the infrastructure or flexibility provided by internationalization (which is ideally performed only once, or as an integral part of ongoing development).
More: https://en.wikipedia.org/wiki/Internationalization_and_localization:
- Extract strings into separate files(s) in JSON-ICU or PO formats and wire them up to be loaded by your app.
- See sections below for platform-specific notes
- Create a PR with above changes in your repository
- Create an issue in this repo to: Add a new project to Transifex
Next steps, after your project is added to Transifex:
- Add
.tx/config
to the PR (read Transifex section below) - Smoke-test by pushing source locale with
tx push -s
- Merge the PR to
master
- Set up automated sync of source locale (read Transifex section below)
That's it!
After this initial setup, the only manual step going forward is fetching new translations with tx pull -a
as a part of release dance of your project.
The most important is to use future-proof format for locale files, such as ICU, JSON-ICU or gettext (.po
).
Make sure to read and understand how plurals and genders impact translations, and how to define plurals in JSON-ICU.
We've had some success with i18next with i18next-icu or using yahoo/intl-messageformat manually.
Transifex is localization platform for crowdsourcing translations from IPFS Community.
- Installing the Transifex Client
- Understanding
.tx/config
file - Using Transifex with GitHub in Your Development Workflow
- Understanding User Roles
- How Translation Memory works
Transifex use POSIX style _
underscores when in it's locale tags to separate language tag and ISO region code, so en_GB
denotes en
or English as the language, and GB
or Great Britain as the region.
Browsers and the IETF standard use hyphens as the separator, like en-GB
. Some libraries such as i18next look up languages based on the hyphenated IETF language code, with hyphens rather than undercores so we tell the tx
client to map those underscored country specific locales to the hypenated version in the config file .tx/config
by adding:
lang_map = zh_CN: zh-CN, ko_KR: ko-KR
Summary from mozilla/addons-server/issues/5829:
In practice,
zh-CN
andzh-SG
are subsets ofzh-Hans
;zh-TW
andzh-HK
are subset ofzh-Hant
. Sozh-CN
if not resolved directly, should be resolved aszh-Hans
.The difference within the subsets are usually vocabularies and translation costumes (much like the difference between
en_US
anden_UK
). But the scripts used are common within the sets.
More: https://www.w3.org/International/articles/bcp47/
Manually updating source files isn't fun or scalable if you've got frequent updates. To avoid this, you can have Transifex automatically check for updates to your source file. You simply need to provide Transifex with the public URL of the file. The file can be hosted on any service, such as GitHub
Project Manager is able to set up source file sync automation. Every new text that lands in master
branch will be fetched by Transifex. Sync happens twice a day, so translation team gets notification within 24h.
Having this, the only manual step is to fetch fresh translations via tx pull -a
as a part of release dance 💃
Example: Setting up IPFS Companion to sync source locale using raw URL:
https://github.com/ipfs-shipyard/ipfs-companion/raw/master/add-on/_locales/en/messages.json
Each project in Transifex has its own Translation Memory. However, if you have projects which have similar or related content, e.g. [IPFS app and a website], you can share TMs across those projects by creating a TM group. – sharing-tm
Right now we have a single TM group named "ipfs".
We don't accept direct PRs with translated strings coming from users other than Transifex itself, as those changes can be lost.
Translations need to be submitted using Transifex project at https://www.transifex.com/ipfs/public/
PRs that bypass Transifex should be closed without merging, with thank you note and ask to apply changes via Transifex or just a link to ipfs/i18n#how-can-i-contribute-translation-for-my-language (example).
Transifex supports Dark Mode now, it can be enabled in Editor Preferences:
In the past, we had to use dedicated extensions:
- Dark Reader (Universal Browser Extension)
- Dark Theme for OLED
- Geeko Dark Theme