Open PhilippeAccorsi opened 4 years ago
We need to define a process on what to do to handle external contributions related to the translations.
Should we ask the contributor if they would like us to ask him when updating the translation is needed.
We also should think about setting up a collaborative translation platform. LibreOffice uses Weblate for instance.
Updated issue with Caldav translation.
For backend, the documentation is here: https://github.com/tracim/tracim/blob/develop/backend/doc/i18n.md It's for all translation in backend, it's mostly (only ?) used for email template but may be used in other backend context.
It's also important to notice that backend does not really store the fact it support this or this language, and there is no endpoint to say "we support these languages".
So, if translation is done only in frontend, user will be set to the correct language but translation will not work as expected for backend side things like email templates. In the other side, if frontend doesn't support a langage but backend did, unless you use api directly, frontend will not let you change the lang.
In the frontend, here are some files to update (not exhaustive, feel free to edit my comment):
frontend_lib/src/index.js
- relevant section - add a line for the new translation there:
export const enTranslation = require('../i18next.scanner/en/translation.json')
export const frTranslation = require('../i18next.scanner/fr/translation.json')
export const ptTranslation = require('../i18next.scanner/pt/translation.json')
frontend_XXX/i18next.scanner/{lang}/translation.json
In file frontend/src/i18n.js
:
import { frTranslation, enTranslation, ptTranslation } from 'tracim_frontend_lib'
```js
import en from '../i18next.scanner/en/translation.json'
import fr from '../i18next.scanner/fr/translation.json'
import pt from '../i18next.scanner/pt/translation.json'
Include the language in this block:
export const getBrowserLang = () => {
const browserLang = navigator.language
if (['en', 'fr', 'pt'].includes(browserLang)) return browserLang
if (browserLang.includes('fr')) return 'fr' // for fr-XX
if (browserLang.includes('pt')) return 'pt' // for pt-XX
return 'en'
}
build_XXX.sh
of each frontend component to copy the translation file to frontend/
i18next.scanner.js
to add the code of the language to the list of language code that is there.This needs improvement and automation that I'd by happy to take.
Feature description
We need an explicit documentation about what is necessary to add new translation in Tracim. Also what we need to do to update this translation when new development is done (ask contributor to update his translation? Do nothing and if something is not translated correctly, contributor can update translation?)
Context
This is a list (not complete list) of what or where change is necessary to add new language in Tracim:
backend/doc/i18n.md
backend/development.ini.sample
for the default language settingbackend/tracim_backend/templates/user_custom_properties/default/locale/
)i18next.scanner.js
yarn build:translation
in each app + frontend + frontend_lib)frontend/src/util/i18n.js
andfrontend_lib/src/index.js
frontend/src/reducer/lang.js
frontend_lib/src/helper.js
TINYMCE_LANGUAGE
object infrontend/src/util/tinyMceInit.js
to add the mapping.@all
mention to the group mention list infrontend_lib/src/mentionOrLink.js
Prerequisites
Impacted components
Extra information