> > Would it be easier to just do
> >
> > <?= strftime("%x", mktime(0, 0, 0, 3, 5, 2021)) ?>
> >
> > .. and skip month_names[], its lookup, relying on the user to figure out
> > how to "translate" "%1\$s %2\$s %3\$s", and documenting how to
translate it?
>
> Would this address Shin-Ichi's issue?
It does, and the output does come out "correct" for all languages libc has
locale data for, but the European language output uses numerals instead of
the full month names which feels less polished. So for US English it
outputs "01/30/2021" instead of "January 30, 2021", for French it outputs
"30/01/2021" instead of "30 janvier 2021", etc. C is the worst, outputting
"01/30/21" instead of something more sensible like "2021-01-30" (ISO
standard).
If we want the output to be correct for all languages by default but be
able to polish it up for some select languages something like this may be
reasonable:
<?= strftime(gettext("%x"), strtotime("2021-01-30")) ?>
... and let each language override "%x" (localized default) with "%e %B %Y"
("30 January 2021") or "%B %e, %Y" ("January 30, 2021) or "%F"
("2021-01-30").
If having gettext("%x") everywhere is a problem it can be wrapped with a
function like so once in include.php:
function localized_date($date) {
return strftime(gettext("%x"), strtotime($date));
}
... then called like so from other php files:
<?= localized_date("2021-01-30") ?>
Mark
On Sun, Mar 7, 2021 at 1:25 AM Bill Kendrick <nb...@so...> wrote:
> On Fri, Mar 05, 2021 at 11:19:26PM -0500, Mark Kim wrote:
> > > <?= sprintf(gettext("%1\$s %2\$s %3\$s"), 5, $month_names[3], 2021) ?>
> ?>
> >
> > Would it be easier to just do
> >
> > <?= strftime("%x", mktime(0, 0, 0, 3, 5, 2021)) ?>
> >
> > .. and skip month_names[], its lookup, relying on the user to figure out
> > how to "translate" "%1\$s %2\$s %3\$s", and documenting how to translate
> it?
>
> Would this address Shin-Ichi's issue?
>
> -bill!
>
>
> > On Fri, Mar 5, 2021 at 1:02 PM Bill Kendrick <nb...@so...> wrote:
> >
> > > On Thu, Mar 04, 2021 at 11:12:36AM +0100, Miguel Bouzada wrote:
> > > > I saw that now it appears to translate "March" ... and the other 11
> > > months?
> > >
> > > I think perhaps I should have them all ready for use in
> > > pre-translated strings, like:
> > >
> > > $month_names[] = array(
> > > "", /* zeroth */
> > > gettext("January"),
> > > gettext("February"),
> > > ...
> > > gettext("December")
> > > );
> > >
> > > And then use them in the documentation like so:
> > >
> > > <?= sprintf(gettext("%1\$s %2\$s %3\$s"), 5, $month_names[3], 2021)
> ?> ?>
> > >
> > > -bill!
> > >
> > > >
> > > > O xov., 4 de mar. de 2021 ás 07:56, Bill Kendrick (<nb...@so...>)
> > > > escribiu:
> > > >
> > > > > On Tue, Mar 02, 2021 at 05:24:28PM +0900, TOYAMA Shin-ichi wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I have just finished working on "README".
> > > > >
> > > > > Thanks!
> > > > >
> > > > >
> > > > > > While checking the generated html file, I found that notation for
> > > > > > date and time look strange. For example at the release date on
> > > > > > the topmost and at the example for the naming of PNG file.
> > > > > >
> > > > > > It seems that strftime() does not output strings in proper order
> > > > > > at least for Japanese.
> > > > >
> > > > > Hrm, I wonder if it's an artifact of my laptop's configuration
> > > > > (since that's where I run "make" which runs "php" to do all
> > > > > of the work to generate the HTML).
> > > > >
> > > > >
> > > > > > Then, I think it is more flexible for translators for various
> > > > > > languages to simply separate Year, Month and Day as follows,
> > > > > >
> > > > > > sprintf(gettext("%1\$s %2\$s %3\$s"), 21, gettext("February"),
> > > 2021)
> > > > >
> > > > > Okay, thanks!
> > > > >
> > > > >
> > > > > > One more thing,
> > > > > >
> > > > > > "msgid" for the following sentence looks missing.
> > > > > >
> > > > > > Save the picture in PNG format. It is highly recommended that you
> > > name
> > > > > the filename using the current date and time, since that's the
> > > convention
> > > > > Tux Paint uses:
> > > > >
> > > > > Hah! Whoops, yes! There were a _lot_ of strings to
> > > > > wrap in gettext(), and I wanted to do it manually so
> > > > > I could rewrite things here & there to try and consolidate
> > > > > strings so there'd be a _few_ less to have to translate. :)
> > > > >
> > > > > Thanks for your keen eye!
> > > > >
> > > > > -bill!
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Tuxpaint-i18n mailing list
> > > > > Tux...@li...
> > > > > https://lists.sourceforge.net/lists/listinfo/tuxpaint-i18n
> > > > >
> > > >
> > > >
> > > > --
> > > > Membro do «Grupo de Amigos GNU/Linux de Pontevedra (GALPon)»
> > > > http://galpon.org
> > > > Membro de «Proxecto Trasno» http://trasno.gal
> > > > Co-coordinador do proxecto «GALPon MiniNo» http://minino.galpon.org
> > >
> > >
> > > > _______________________________________________
> > > > Tuxpaint-i18n mailing list
> > > > Tux...@li...
> > > > https://lists.sourceforge.net/lists/listinfo/tuxpaint-i18n
> > >
> > >
> > > --
> > > -bill!
> > > Sent from my computer
> > >
> > >
> > > _______________________________________________
> > > Tuxpaint-devel mailing list
> > > Tux...@li...
> > > https://lists.sourceforge.net/lists/listinfo/tuxpaint-devel
> > >
>
>
> > _______________________________________________
> > Tuxpaint-devel mailing list
> > Tux...@li...
> > https://lists.sourceforge.net/lists/listinfo/tuxpaint-devel
>
>
> --
> -bill!
> Sent from my computer
>
>
> _______________________________________________
> Tuxpaint-devel mailing list
> Tux...@li...
> https://lists.sourceforge.net/lists/listinfo/tuxpaint-devel
>
|