Mailinglist Archive: yast-devel (52 mails)

< Previous Next >
Re: [yast-devel] Dates localization in YaST
On Wed, Feb 11, 2015 at 06:18:02PM +0100, Ancor Gonzalez Sosa wrote:
While writing the YaST Journal module I faced a problem I'm not sure how
to solve. I wanted to format a date here:
https://github.com/ancorgs/yast-journal/blob/master/src/lib/systemd_journal/entry_presenter.rb#L49

I wanted to mimic the format used by journalctl itself, which in plain
English would be "%b %d %H:%M:%S". The problem is that using %b is not
i18n-friendly. Obviously the problem goes further, like those crazy US
people writing Feb. 1st as 02/01/2015. :-)

In Rails the i18n gem is used. It offers an "localize" method that deals
with date formatting
http://www.rubydoc.info/github/svenfuchs/i18n/master/I18n/Backend/Base:localize

But I don't know how to do it in YaST or if I'm the first one facing the
problem.

No, you are not the first one - I had a bug for SLES 12 (bsc
#878613) where the weekday was not translated. Since Ruby is
stuck in the last millennium concerning localization the simply
solution was to use the ISO format (which does not require
translations).

ciao Arvin

--
Arvin Schnell, <aschnell@xxxxxxx>
Senior Software Engineer, Research & Development
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip
Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)
Maxfeldstraße 5
90409 Nürnberg
Germany
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
References