On 11 Apr 2017, at 07:06, Rafal Luzynski
<digitalfreak(a)lingonborough.com> wrote:
Dear Translators,
I'm writing these tips in hope they are useful.
Did you ever have to translate a string which consists mainly
of some magic "percent-letter" sequences, with a comment that
this is a date format or that you should read the strftime(3)
man page for the full format specification or sometimes even
without any comment at all? Here I'd like to explain only two
format specifiers:
- "%d" will produce the day of the month number preceded with
zero if it is less than 10 (01, 02, ..., 09, 10, 11...)
- "%e" will produce the day of the month number preceded with
a space if it is less than 10 (" 1", " 2", ... " 9",
"10"...)
If this is what you want to achieve then leave this as it is.
However, if you prefer to achieve a plain decimal number without
any additional padding in your translated date format you should
put "-" between the percent character and the letter. This "-"
means "do not pad the day number with an additional zero nor an
additional space". So summarizing:
- "%B %d" will produce "April 09";
- "%B %e" will produce "April 9" (notice two spaces);
- "%B %-d" will produce "April 9";
- "%B %-e" will produce "April 9".
Yes, "%-d" and "%-e" produces the same output.
Of course, "April" will be translated to your language automatically,
and of course you can reorder the format specifiers (do you want
"April 9" or "9 April"?) and you can put something different between
the format specifiers than a single space, according to the rules
of your language.
Best regards,
Rafal
Hi Rafal,
It's very helpful. Thanks. There is an old L10n tips wiki page on Fedora wiki, it will
be better if this can be added in there. Sorry I couldn't find the URL now, but I will
try to find it if you are willing to share it on the wiki.
Regards
From my mobile phone
Tiansworld