Debian Codegraph @

android/app/jni/po/README.md

raw
1 # po
2
3 these are GNU gettext Portable Object language translation files for Furnace.
4
5 if you want to help translating Furnace to your language, read below.
6
7 # getting started
8
9 Furnace uses GNU gettext for language support.
10 it was chosen over other solutions due to notable advantages such as ease of use.
11
12 text strings in the source code are marked for translation with special delimiters.
13 afterwards, xgettext is used to extract these and generate a "template" file (furnace.pot) which contains all translatable strings.
14 some other tools are then used to generate new translation files (e.g. es.po for Spanish) or update them.
15 during build time, these translation files are converted into binary translation data which is then distributed in releases.
16
17 Furnace ships a script to help with the string extraction and translation file updating process.
18
19 # preparing
20
21 read the following instructions before you start working with translation files.
22
23 ## preparing the environment
24
25 while you may edit translation files regardless of the employed method, setting them up (adding new languages, updating translation files or compiling these) is best done on a Linux environment with the GNU gettext tools installed.
26
27 if you use Windows, you may be able to perform setup through the Unix-like MSYS2 environment. see https://www.msys2.org/ for more information.
28
29 if you cannot/aren't willing to go through the process of preparing the environment, you may contact me so I can perform setup on my side and provide you with ready-to-edit translation files.
30
31 for the testing stage, Linux or Windows with MinGW (installed through the MSYS2 environment) is necessary. Visual Studio/MSVC is not supported yet.
32
33 ## adding a new language
34
35 in order to add a new language, edit the setup script located in `scripts/update-po.sh`.
36 add a language code to the `EXPORT_LANGS` list (see `https://en.wikipedia.org/wiki/IETF_language_tag` for a list of common language codes).
37 then run the script in your environment:
38
39 ```
40 cd path/to/Furnace/repo
41 ./scripts/update-po.sh
42 ```
43
44 if successful, a new file (.po) will be created in the `po` directory that you can edit using a text editor.
45
46 ## editing an existing translation
47
48 just open the translation file in your text editor.
49
50 # translating
51
52 once you've opened the translation file, you'll see a bunch of strings that may be translated.
53
54 "msgid" is the original string in English, whereas "msgstr" is the translation. fill this in with a translated version of the English string.
55
56 the `#:` line at the top points to the source code file(s) where the string appears. you may use this if you need to understand which context is the string being used in.
57
58 if a string is marked with "c-format", it means the string contains C format codes. these codes consist of a percent sign (`%`) and a type (but don't worry too much about it).
59 make sure to place these format codes in the translated string appropriately, as if they were objects or subjects in a sentence.
60
61 sometimes you will see a string marked as "fuzzy" after running the setup script. if this appears, it means that it is a new string that looks like another. the translation is filled in automatically, but don't trust it as it's almost guaranteed to be wrong.
62
63 a `\n` means a line break.
64
65 # compiling
66
67 to compile your .po file(s) into mo (Machine Object) files which contains translation data that can be consumed by Furnace, run:
68
69 ```
70 cd path/to/Furnace/repo
71 ./scripts/build-po.sh
72 ```
73
74
75 if you've encounter a error during compiling, fix it.
76
77 if you did this correctly, you will see a directory called `locale` in the po/ directory, containing compiled translation files (with `.mo` extension).
78
79 # testing
80
81 you may skip this step if you don't feel like building Furnace, or are unable to.
82
83 compile Furnace (see the project's README.md file (the developer info section) for information), but in the CMake stage, be sure to pass the CMake flag `-DWITH_LOCALE=ON` before the two dots (`..`) to enable language support in Furnace and therefore compile translation files.
84
85
86 run Furnace from the build directory like so:
87
88 ```
89 LANG=language-code ./furnace
90 ```
91
92 replace `language-code` with the language code to use.
93
94 on Linux, you'll need to add .UTF-8 to language-code.
95
96 you should see Furnace start up in the language you specified. if it doesn't, check out the logs.
97
98 # submitting
99
100 after doing some work, be sure to submit it so you see it in the next version.
101
102 you can contact me via email or Discord (be sure to send the translation file), or alternatively send a pull request on GitHub. the latter is preferred if you're going to work frequently.
103
104 if sending a pull request, be sure to target the `master` branch.
105
106 that's all for now. thank you for helping translate Furnace, and good luck!
107
108 - tildearrow
109
110 # footnotes
111
112 ## note 1
113
114 the "LocaleSettings: ccjk" string is special. it allows you to define which character sets to load.
115
116 this is needed by a couple languages, such as Chinese, Japanese and Korean.
117
118 the letters after LocaleSettings mean, in the following order: Chinese (simplified), Chinese (traditional), Japanese and Korean. if any of these is in caps, the corresponding character set will be loaded.
119
120 some values include:
121
122 ```
123 zh_CN: Ccjk
124 zh_HK: cCjk
125 ja_JP: ccJk
126 ko_KR: ccjK
127 ```
128
129 you can load other character ranges by defining them next to the "ccjk" part. for example:
130
131 ```
132 LocaleSettings: ccjk 1000-107F 1100-107F
133 ```
134
135 each range is in the format FROM-TO, where FROM and TO are hexadecimal values.
136 if you just want to load one particular character, you still have to specify both FROM and TO. for example 1000-1000.