1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/doc/translation_readme.md

97 lines
5.6 KiB
Markdown
Raw Normal View History

2020-02-26 10:19:43 +01:00
# Fab-manager translation documentation
2020-02-26 10:19:43 +01:00
This document will explain you what you need to know to contribute to the translation process of Fab-manager.
##### Table of contents
2019-12-16 10:39:48 +01:00
1. [Translation](#translation)<br/>
1.1. [Using a TMS](#using-a-tms)<br/>
2019-12-23 15:32:33 +01:00
1.2. [Using In-Context translation](#using-in-context-translation)<br/>
1.3. [From the files](#from-the-files)<br/>
1.3.1 [Front-end translations](#i18n-translation-front)<br/>
1.3.2 [Back-end translations](#i18n-translation-back)
2019-12-16 10:39:48 +01:00
2. [Configuration](#configuration)<br/>
2.1. [Settings](#settings)<br/>
2.2. [Applying changes](#applying-changes)
<a name="translation"></a>
## Translation
2019-12-16 10:39:48 +01:00
<a name="using-a-tms"></a>
### Using a TMS
2020-02-26 10:19:43 +01:00
We use [Crowdin](https://www.crowdin.com), a translation management system (TMS) to simplify translator's job in Fab-manager.
2019-12-16 10:39:48 +01:00
You can access it at [translate.fab-manager.com](https://translate.fab-manager.com) and start translating to one of the already configured languages.
2020-02-26 10:19:43 +01:00
If you want to translate Fab-manager to a new language, just send us an email to [contact@fab-manager.com](mailto:contact@fab-manager.com) and we'll add this new language to the TMS.
2019-12-16 10:39:48 +01:00
2019-12-23 15:32:33 +01:00
<a name="using-in-context-translation"></a>
2019-12-23 15:31:18 +01:00
### Using In-Context translation
To translate the front-end application (angularJS client), and the notifications, you can use [Crowdin In-Context](https://crowdin.com/page/in-context-localization).
2020-02-26 10:19:43 +01:00
This allows you to use Fab-manager as normally, but with the addition of small "edit" icons on the top-left corner of each text blocs.
2019-12-23 15:31:18 +01:00
Clicking on this "edit" icon will open the Crowdin translation interface and you'll be able to translate or modify existing translations directly.
You can access it at [in-context.translate.fab-manager.com](https://in-context.translate.fab-manager.com/).
2019-12-16 10:39:48 +01:00
<a name="from-the-files"></a>
### From the files
2020-03-11 12:13:43 +01:00
You **should not** translate Fab-manager from the source files, because it will conflict with the TMS.
Please refer to the [TMS method](#using-a-tms) for more details.
2019-12-16 10:39:48 +01:00
2020-05-27 17:40:43 +02:00
Nevertheless, **if you add a new feature** that requires some new translations, just add them to the english files.
You'll be able to provide translations for other languages later, using our TMS.
2020-05-27 17:40:43 +02:00
Moreover, if you want to improve the english texts, you'll need to modify the english files.
To add or edit the english translations, check the files located in `config/locales`:
2020-03-11 12:13:43 +01:00
- Front app translations (angular.js) are located in `config/locales/app.SCOPE.en.yml`.
Where SCOPE has one the following meaning :
- admin: translations of the administrator views (manage and configure the FabLab).
- logged: translations of the end-user's views accessible only to connected users.
- public: translation of end-user's views publicly accessible to anyone.
- shared: translations shared by many views (like forms or buttons).
2020-03-11 12:13:43 +01:00
- Back app translations (Ruby on Rails) are located in `config/locales/en.yml`.
- Emails translations are located in `config/locales/mails.en.yml`.
- Messages related to the authentication system are located in `config/locales/devise.en.yml`.
To prevent syntax mistakes while translating locale files, we **STRONGLY advise** you to use a text editor which support syntax coloration for YML and Ruby.
As an example, [Visual Studio Code](https://code.visualstudio.com/), with the [Ruby extension](https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby) and the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) will do the job.
<a name="i18n-translation-front"></a>
2019-12-16 10:39:48 +01:00
#### Front-end translations
Front-end translations uses [angular-translate](http://angular-translate.github.io) with interpolations interpreted by [MessageFormat](https://github.com/SlexAxton/messageformat.js/).
2020-03-11 12:13:43 +01:00
**Please read the documentation about the [ICU MessageFormat syntax](http://userguide.icu-project.org/formatparse/messages#TOC-MessageFormat) before writing new strings.**
2020-03-11 12:13:43 +01:00
To translate existing strings, you should use our [translation management system](https://translate.fab-manager.com/).
<a name="i18n-translation-back"></a>
2019-12-16 10:39:48 +01:00
#### Back-end translations
Back-end translations uses the [Ruby on Rails syntax](http://guides.rubyonrails.org/i18n.html) but some complex interpolations are interpreted by [MessageFormat](https://github.com/format-message/message-format-rb) and are marked as it in comments.
**DO NOT confuse the syntaxes.**
In each cases, some inline comments are included in the localisation files.
They can be recognized as they start with the sharp character (#).
These comments are not required to be translated, they are intended to help the translator to have some context information about the sentence to translate.
You will also need to translate the invoice watermark, located in `app/pdfs/data/`.
You'll find there the [GIMP source of the image](app/pdfs/data/watermark.xcf), which is using [Rubik Mono One](https://fonts.google.com/specimen/Rubik+Mono+One) as font.
Use it to generate a similar localised PNG image which keep the default image size, as PDF are not responsive.
2019-12-16 10:39:48 +01:00
<a name="configuration"></a>
## Configuration
In development, locales configurations are made in [.env](../env.example).
In production, locales configuration are made in the [config/env](../setup/env.example) file.
If you are in a development environment, your can keep the default values, otherwise, in production, values must be configured carefully.
2019-12-16 10:39:48 +01:00
<a name="settings"></a>
### Settings
2019-12-03 17:32:27 +01:00
Please refer to the [environment configuration documentation](environment.md#internationalization-settings)
2019-12-16 10:39:48 +01:00
<a name="applying-changes"></a>
### Applying changes
After modifying any values concerning the localisation, restart the application (ie. web server) to apply these changes in the i18n configuration.