Benefits of compiling po files to mo Ask Question. Asked 3 years, 1 month ago. Active 1 year, 11 months ago. Viewed times. Improve this question. Konrad Konrad 4, 11 11 gold badges 43 43 silver badges 80 80 bronze badges. Add a comment. Active Oldest Votes. There are several reasons: You should always compile PO files with msgfmt --check which performs several important checks on the PO file, not only a syntax check.
Failure to do so, may result in crashs at runtime. There are a lot more checks, depending on the programming language.
Reading a binary MO file is usually faster and simpler than parsing a textual PO file. PO files often have translation entries that should not be used for production, for example fuzzy or obsolete entries.
Many PO parsers are buggy or incomplete. It is part of the gettext API. That does, of course, not apply to the countless libraries that just implement a subset of the gettext API. Active 4 years, 9 months ago. Viewed 9k times. How can I solve it? Improve this question. Add a comment. Active Oldest Votes. Improve this answer. I forgot to write the correct usage. I've edited my answer.
Sign up or log in Sign up using Google. Sign up using Facebook. These flags should not be added by a human. Instead only the xgettext program adds them. The c-format flag indicates that the untranslated string and the translation are supposed to be C format strings.
When the c-format flag is given for a string the msgfmt program does some more tests to check the validity of the translation. See msgfmt Invocation , c-format Flag and c-format. Likewise for Python brace, see python-format. Likewise for Java MessageFormat format strings, see java-format. Likewise for Java printf format strings, see java-format. Likewise for JavaScript, see javascript-format.
Likewise for Object Pascal, see object-pascal-format. Likewise for Smalltalk, see smalltalk-format. Likewise for Qt plural forms, see qt-plural-format. Likewise for the GCC sources, see gcc-internal-format. The context serves to disambiguate messages with the same untranslated-string. It is possible to have several entries with the same untranslated-string in a PO file, provided that they each have a different context.
Note that an empty context string and an absent msgctxt line do not mean the same thing. Here also, a msgctxt context can be specified before msgid , like above. This flag is followed by a range of non-negative numbers, using the syntax range: minimum-value..
It designates the possible values that the numeric parameter of the message can take. In some languages, translators may produce slightly better translations if they know that the value can only take on values between 0 and 10, for example. The previous-untranslated-string is optionally inserted by the msgmerge program, at the same time when it marks a message fuzzy.
It helps the translator to see which changes were done by the developers on the untranslated-string.
0コメント