As far as I know, the Lazarus IDE does not generate extracted-comments which "xgettext program extracts from the program’s source code." Similarly, I have not seen previous context elements in a. The context element ( msgctxt) is optional in GNU gettext and Lazarus. The other types of comments are optional in the Lazarus implementation. In the Lazarus implementation, the reference comment that begin with "#: " is mandatory otherwise the entry will be treated as a header or ignored if a header has already been defined. In GNU gettext all lines that begin with the comment character "#" are optional. While gettext tools, including the Lazarus implementation, generate a single blank line between entries, I believe this is optional. Here is a definition of a standard entry. The GNU specification includes other elements in an entry. Are there other "special" ASCII characters that cause problems during translation? Instead I changed the resource string to "JSON files" and built the filter string with it adding the constant "|.json". Perhaps replacing the character with its Unicode escape sequence would work, but after thinking about it, it struck me that it made no sense to enable a translator to change a file extension. I tried escaping the character with "\|" without success. I have found that it was not possible to translate a file dialog filter such as "JSON files|*.json" with "Fichiers JSON|*.json". However, the ASCII character 174 (0x7C), the vertical bar | does cause problems. I have not investigated more esoteric escape sequences. The basic escape sequences \n for a new line, \t for a tabulation, \" for a double quote and \\ for the escape character \ will work in Free Pascal. Msgid "" "first line\n" "second line\n" "of the untranslated-string" msgstr "" "première ligne\n" "secondeligne\n" "de la chaîne traduite"Īs a matter of fact, " untranslated-string and translated-string the C syntax for a character string, including the surrounding quotes and embedded backslashed escape sequences" according to the GNU documentation. The syntax of the basic entry is as follows. This is a one-time operation and should not impact execution time afterwards. When a program is launched, each its untranslated strings is replaced with its translation except if the translated string happens to be blank. Each entry must contain a pair strings: the untranslated string tagged with the msgid keyword followed by its translation marked with the msgstr keyword. So app.fr.po and app.sp.po are, respectively, the French and Spanish translations of an application named app.Ī translation file is composed of entries for each string to be translated. The natural language of each translation is specified with a language code suffix (usually a two-letter code, but there are exceptions) before the file extension which is always. As is often the case, the Lazarus team simplified the approach and the convention is now to store all translation files in a subdirectory named languages or locale. The original gettext system (and dxgettext) used a complicated hierarchy of directories to identify the natural language found in each file. Each language into which a program has been translated has its own. Have I earned credits for not naming this section "PO Files In Courage"? It was very tempting.Ī PO file, also called a gettext catalogue, is a text file which contains a list of strings used in a program along with their translation into another natural language. Hopefully, this will not cause confusion. This is only a small part of what is called the Lazarus implementation of gettext below. It provides procedures to translate resource strings from MO files which are compiled PO files. There is a unit called gettext in the Free Pascal run time library. This text presents some of the information obtained from the GNU project and some experimentation done to identify the way Free Pascal and Lazarus implement gettext. In retrospect, it would have been better to be more patient before uploading these programs, until I had studied the GNU gettext translation system more closely. However they were initially written in Delphi in a haphazard fashion over a number of years when I used dxgettext to internationalize some applications. po translation files automatically created by the Lazarus IDE when internationalization is enabled, are written in Free Pascal. Not very long ago, I uploaded a set of command line utilities to a GitHub repository called poutils.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |