Translations: Add README.md files
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
db5edb8e4d
commit
73e7911b5e
2 changed files with 99 additions and 0 deletions
37
assets/locales/README.md
Normal file
37
assets/locales/README.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Backend Translations
|
||||
|
||||
PhotoPrism uses [gettext](https://en.wikipedia.org/wiki/Gettext) for localizing frontend and backend.
|
||||
It's one of the most widely adopted standards for translating user interfaces.
|
||||
|
||||
Human readable messages like `File not found` are used as ids for finding matching translations,
|
||||
and used as defaults whenever there is no translation available.
|
||||
|
||||
Messages may optionally contain placeholders, like `Found %d files`, for numbers and
|
||||
other variables.
|
||||
|
||||
We strongly recommend [Poedit](https://poedit.net/download) for creating and updating translations.
|
||||
Download is free for Mac, Windows and Linux.
|
||||
It's source code can be obtained on [GitHub](https://github.com/vslavik/poedit).
|
||||
|
||||
Only asynchronous notifications and certain API responses need translation to provide a
|
||||
consistent user experience.
|
||||
Technical log messages should be in English to avoid ambiguities and (even slightly) wrong translations.
|
||||
|
||||
`default.po` files in sub directories contain localized messages for each
|
||||
[language](https://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html#Usual-Language-Codes),
|
||||
identified by their [two-letter locale](https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html),
|
||||
like `de/default.po` for German. You can open, edit and save them with Poedit. Please
|
||||
also add and commit binary `*.mo` files, which will be automatically created by Poedit.
|
||||
|
||||
To add a new translation, open `messages.pot`, click on "Create New Translation" at the bottom, select
|
||||
the language, and start translating.
|
||||
When done, create a new directory (using the locale as name) and save your translation there as `default.po`.
|
||||
|
||||
The POT file `/assets/locales/messages.pot` will be automatically updated when
|
||||
running `go generate` in `/internal/i18n` or `make generate` in the main project directory.
|
||||
Note that this will only work when you have gettext installed on your system.
|
||||
We recommend using our latest development image as described in the Developer Guide.
|
||||
|
||||
Apply changes to existing translations by clicking on "Catalogue" > "Update from POT File..."
|
||||
in the Poedit app menu.
|
||||
|
62
frontend/src/locales/README.md
Normal file
62
frontend/src/locales/README.md
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Frontend Translations
|
||||
|
||||
PhotoPrism uses [gettext](https://en.wikipedia.org/wiki/Gettext) for localizing frontend and backend.
|
||||
It's one of the most widely adopted standards for translating user interfaces.
|
||||
|
||||
Human readable messages like `File not found` are used as ids for finding matching translations,
|
||||
and used as defaults whenever there is no translation available.
|
||||
|
||||
Messages may optionally contain placeholders, like `Found %{n} files`, for numbers and
|
||||
other variables.
|
||||
|
||||
We strongly recommend [Poedit](https://poedit.net/download) for creating and updating translations.
|
||||
Download is free for Mac, Windows and Linux.
|
||||
It's source code can be obtained on [GitHub](https://github.com/vslavik/poedit).
|
||||
|
||||
`*.po` files contain localized messages for each
|
||||
[language](https://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html#Usual-Language-Codes),
|
||||
identified by their [two-letter locale](https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html),
|
||||
like `de.po` for German.
|
||||
You can open, edit and save them with Poedit to update existing translations.
|
||||
|
||||
!!! info
|
||||
As it doesn't seem necessary for now, and to reduce the amount of work,
|
||||
we don't maintain translations for dialects like `de_AT` or `pt_BR`.
|
||||
|
||||
To add a new translation, open `translations.pot`, click on "Create New Translation" at the bottom, select
|
||||
the language, and start translating.
|
||||
When done, save your translation as `*.po` file using the two-letter language locale as name.
|
||||
In addition, the new language needs to be added to the `Languages` function
|
||||
in `/frontend/src/options/options.js`.
|
||||
|
||||
If you have a working development environment in place:
|
||||
|
||||
Running `npm run gettext-compile` in the `frontend` directory compiles existing translations into
|
||||
a single `translations.json` file.
|
||||
|
||||
Now start a frontend build using `npm run build` or keep
|
||||
|
||||
```
|
||||
npm run watch
|
||||
```
|
||||
|
||||
running in the background to automatically recompile JS and CSS whenever there
|
||||
are changes. Lastly, make sure `photoprism` is running and open the Web UI in a supported browser. Changing
|
||||
the language in Settings automatically triggers a reload.
|
||||
|
||||
To extract new or changed text needing translation from `*.js` and `*.vue` source code, run
|
||||
|
||||
```
|
||||
npm run gettext-extract
|
||||
```
|
||||
|
||||
in the `frontend` directory. This updates the POT file `translations.pot`.
|
||||
|
||||
Apply changes to existing translations by clicking on "Catalogue" > "Update from POT File..."
|
||||
in the Poedit app menu.
|
||||
|
||||
!!! note
|
||||
A binary `*.mo` (machine object) file will be automatically saved along with every `*.po` file.
|
||||
You won't be able to open those in a text editor, but please include them in git commits or when sending
|
||||
translations via email. The compiled `translations.json` file is not required for pull requests
|
||||
and often causes merge conflicts.
|
Loading…
Reference in a new issue