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:
parent
204b201918
commit
e364b551d6
5 changed files with 35 additions and 3 deletions
8
pages/common/gettext.md
Normal file
8
pages/common/gettext.md
Normal 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}}`
|
|
@ -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
12
pages/common/msginit.md
Normal 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
8
pages/common/msgmerge.md
Normal 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}}`
|
|
@ -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:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue