1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-23 11:55:31 +02:00

gettext, msginit, msgmerge: add page; msgfmt, xgettext: edit page (#15912)

Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: Juri Dispan <juri.dispan@posteo.net>
This commit is contained in:
Managor 2025-03-11 06:50:50 +02:00 committed by GitHub
parent 204b201918
commit e364b551d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 35 additions and 3 deletions

8
pages/common/gettext.md Normal file
View file

@ -0,0 +1,8 @@
# gettext
> Get string translations.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/gettext-Invocation.html>.
- Get the translation of a string or output a default string if it doesn't exist:
`LANGUAGE={{locale}} gettext {{msgid}} {{default_value}}`

View file

@ -3,6 +3,10 @@
> Compile message catalog to binary format.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html>.
- Compile a file to `messages.mo`:
`msgfmt {{file.po}}`
- Convert a `.po` file to a `.mo` file:
`msgfmt {{path/to/file.po}} -o {{path/to/file.mo}}`
`msgfmt {{path/to/file.po}} {{[-o|--output-file]}} {{path/to/file.mo}}`

12
pages/common/msginit.md Normal file
View file

@ -0,0 +1,12 @@
# msginit
> Generate language specific translation files based on Portable Object Templates.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/msginit-Invocation.html>.
- Generate Portable Object files in system locale from `messages.pot`:
`msginit`
- Define locale to generate from a specific template:
`msginit {{[-l|--locale]}} {{locale}} {{[-i|--input]}} {{path/to/messages.pot}}`

8
pages/common/msgmerge.md Normal file
View file

@ -0,0 +1,8 @@
# Exclamation mark
> Update an existing translation file from a new template.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/msgmerge-Invocation.html>.
- Update a translation file:
`msgmerge {{[-U|--update]}} {{path/to/file.po}} {{path/to/messages.pot}}`

View file

@ -9,11 +9,11 @@
- Use a different output filename:
`xgettext --output {{path/to/output_file}} {{path/to/input_file}}`
`xgettext {{[-o|--output]}} {{path/to/output_file}} {{path/to/input_file}}`
- Append new strings to an existing file:
`xgettext --join-existing --output {{path/to/output_file}} {{path/to/input_file}}`
`xgettext {{[-j|--join-existing]}} {{[-o|--output]}} {{path/to/output_file}} {{path/to/input_file}}`
- Don't add a header containing metadata to the output file: