]>
Commit | Line | Data |
---|---|---|
4aa14066 | 1 | This is the README file for the internationalization sample for wxWidgets. |
fd323a5e VZ |
2 | |
3 | Q. What does this stupid program do? | |
4 | A. It demonstrates how to translate all program messages to a foreign language. | |
4aa14066 FM |
5 | In any program using wxWidgets there is going to be 3 kinds of messages: the |
6 | messages from the program itself, the messages from the wxWidgets library and | |
fd323a5e VZ |
7 | the messages from the system (e.g. system error messages). This program |
8 | translates the first 2 kinds of messages but the system messages will be only | |
9 | translated if your system supports it. | |
10 | ||
11 | Brief usage summary: "Test|File" tries to open a non existing file (provoking | |
12 | system error message), "Test|Play" shows a message box asking for a number. | |
13 | Hint: try some special values like 9 and 17. | |
14 | ||
15 | Q. Why the error message when I try to open a non existing file is only partly | |
16 | translated? | |
17 | A. Your system doesn't have the translation in the language you use, sorry. | |
18 | ||
19 | Q. Why the message when I enter '9' is not translated? | |
20 | A. This is on purpose: the corresponding string wasn't enclosed in _() macro and | |
21 | so didn't get into the message catalog when it was created using xgettext. | |
bf2d9237 | 22 | |
fd323a5e VZ |
23 | Q. Why the message when I enter '17' is only partly translated? |
24 | A. This will only work under some versions of Linux, don't worry if the second | |
25 | half of the sentence is not translated. | |
26 | ||
27 | Q. I don't speak french, what about translations to <language>? | |
28 | A. Please write them - see the next question. French is chosen by default | |
29 | because it's the only translation which is currently available. To test | |
30 | translations to the other languages please run the sample with 2 command line | |
31 | arguments: the full language name and the name of the directory where the | |
32 | message catalogs for this language are (will be taken as 2 first letters of | |
33 | the language name if only 1 argument is given). | |
34 | ||
35 | Q. How to do translations to other language? | |
ce0aa4ba | 36 | A. First of all, you will need the GNU gettext tools (see the next questions). |
fd323a5e VZ |
37 | After you've probably installed them, type the following (example is for Unix |
38 | and you should do exactly the same under Windows). | |
bf2d9237 | 39 | |
fd323a5e VZ |
40 | # all translations forgiven language should be in a separate directory. |
41 | # Please use the standard abbreviation for the language names! | |
42 | mkdir <language> | |
43 | cd <language> | |
44 | ||
45 | # generate the .po file for the program itself | |
46 | # see `xgettext --help' for options, "-C" is important! | |
bf2d9237 FM |
47 | xgettext -C -n -k_ -kwxPLURAL:1,2 -kwxTRANSLATE -o internat.po ../internat.cpp |
48 | ||
49 | # .po file for wxWidgets might be generated in the same way. An already | |
50 | # generated wxstd.pot as well as translations for some languages can be | |
15d06954 | 51 | # found in the locale directory. |
a2b18c57 | 52 | cp ../../locale/<language>.po ./wxstd.pot |
15d06954 | 53 | - or - |
a2b18c57 | 54 | cp ../../locale/wxstd.pot . |
fd323a5e VZ |
55 | |
56 | # now edit the files and do translate strings (this isn't done by gettext) | |
a2b18c57 | 57 | # you can use another editor if you wish :-) No need to edit wxstd.pot if you |
15d06954 | 58 | # already got a translated one. |
a2b18c57 | 59 | vi internat.po wxstd.pot |
fd323a5e VZ |
60 | |
61 | # create the message catalog files | |
62 | msgfmt -o internat.mo internat.po | |
a2b18c57 | 63 | msgfmt -o wxstd.mo wxstd.pot |
fd323a5e VZ |
64 | |
65 | # run the sample to test it | |
66 | cd .. | |
bf2d9237 | 67 | ./internat <language> |
fd323a5e | 68 | |
ce0aa4ba FM |
69 | Q. How to do update the translation of 'internat' sample for a language? |
70 | A. First of all, you will need the GNU gettext tools (see the next question). | |
71 | After you've probably installed them, type the following (example is for Unix | |
72 | and you should do exactly the same under Windows). | |
73 | ||
74 | # enter the directory of an already-existing translations which needs to be updated | |
75 | cd <language> | |
76 | ||
77 | # the -j flag tells xgettext to merge and not simply overwrite the output file | |
78 | xgettext -j -C -n -k_ -kwxPLURAL:1,2 -kwxTRANSLATE -o internat.po ../internat.cpp | |
79 | ||
80 | # now edit the files and do translate the new strings (this isn't done by gettext) | |
81 | vi internat.po | |
82 | ||
83 | # update the message catalog: | |
84 | msgfmt -o internat.mo internat.po | |
85 | ||
fd323a5e VZ |
86 | Q. How to get the gettext tools? |
87 | A. For Unix, you should be able to get the source distribution of any GNU mirror | |
88 | (see www.gnu.org for a start). gettext() version 0.10 is buggy, try to get at | |
89 | least version strictly greater than 0.10. gettext RPMs can be downloaded from | |
90 | the standard locations for Linux. For Windows, you can get the precompiled | |
4aa14066 | 91 | binaries from wxWidgets web page. |
fd323a5e VZ |
92 | |
93 | Q. What's i18n? | |
94 | A. Count the number of letters in the word "internationalization". | |
95 | ||
96 | Q. Where to send comments, | |
97 | additional translations, | |
98 | flames, | |
99 | money? | |
100 | A. To Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>, | |
4aa14066 | 101 | wxWidgets list <wx-dev@lists.wxwidgets.org>, |
fd323a5e | 102 | /dev/null (platform-dependent), |
4aa14066 | 103 | wxWidgets dev team Swiss bank account. |