About date formats
- From: Rafal Luzynski <digitalfreak lingonborough com>
- To: Fedora Translation Project List <trans lists fedoraproject org>, GNOME i18n list <gnome-i18n gnome org>
- Subject: About date formats
- Date: Tue, 11 Apr 2017 01:06:40 +0200 (CEST)
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]