Bug 14538 - Long Date format doesn't use correct locale
: Long Date format doesn't use correct locale
Status: CLOSED FIXED
Product: SqueezePlay
Classification: Unclassified
Component: API
: 7.4.x
: PC Windows Vista
: P3 normal with 2 votes (vote)
: 7.5.0
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-02 14:46 UTC by Stefan Hansel
Modified: 2010-04-08 17:26 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Hansel 2009-10-02 14:46:50 UTC
Go to 
Settings->Screen->Date & Time->Date Format

All options there are always in english, regardless of the selected language.

Calling os.date() from LUA-Applets also gives only english strings, I guess when selecting a language also the os's-locale should be set to solve both problems ?
Comment 1 James Richardson 2009-10-02 15:19:48 UTC
Ben: are the translations for that page in?
Comment 2 Michael Herger 2009-10-02 22:44:47 UTC
Ben - it's only the settings menu. The actual display in the screensaver is ok.
Comment 3 Stefan Hansel 2009-10-03 01:25:00 UTC
the clock-screensafer in 7.3 shows the wrong date-string as well.

erlands 'Custom Clock' screensafer in 7.4 also can't show the correct string, as long as os.date() doesn't give correct date-strings (which it would, if the locale was set correctly I guess)

the settings-menu in just the first visible proof of many follow-up problems ;)
Comment 4 Michael Herger 2009-10-03 02:26:20 UTC
> the clock-screensafer in 7.3 shows the wrong date-string as well.

Should be fixed in 7.4.

> erlands 'Custom Clock' screensafer in 7.4 also can't show the correct

But do you see it on the stock screensavers? Mine says "Samstag, 03.  
Oktober".

I'm sorry to say that this is Erland's problem :-). Sure, we can help him  
fix it the way we fixed our own savers.
Comment 5 Stefan Hansel 2009-10-03 04:26:15 UTC
Michael, 
the stock screensafers don't use the settings (anymore in 7.4), thats why they don't face the problem as well.

The digital-clock just always shows WWWW DD MMMM regardless of your setting.
I could also complain about this as a bug ;)
Or do you have any stock-screensafer which shows a date and respects the settings ?

I marked this bug as an API bug for a reason. 
If (logitech or any custom-applet-developer) wants to respect the settings he has to call os.date(format, date) from LUA. That's how the strings in the settings are generated as well.

Unfortunately this function doesn't return the correct localized version (though it could and should as defined by the LUA-API), that's why the screensaver in 7.3 has problems (as well as any other screensafer which just wants to show a customizable date-string like erlands and my plugins)
Comment 6 Ben Klaas 2009-12-14 14:42:20 UTC
I don't believe there to be a bug here. You can use the jive.utils.datetime functions to return user-defined settings for date and time. It could be that Erland doesn't want to look at that code (there is a long-standing dispute over squeezeplay licensing that has left many of our 3rd party devs unwilling to glance at our code), but I believe the functions are there to display time in whatever way the user has defined.

> The digital-clock just always shows WWWW DD MMMM regardless of your setting.
> I could also complain about this as a bug ;)

On this point I completely disagree- the digital clock does not show a string for the date, it shows three separate objects for day of week, day of month, and month. They may layout horizontally across the screen, but they are clearly separated and are not a string.

I respect your view that you should be able to order those objects on the screen how you like, but that's not how it was designed nor do I see the digital clock being changed in the near future.

>Or do you have any stock-screensafer which shows a date and respects the
settings ?

Yes, dot matrix clock respects the Date & Time->Short Date Format setting
Comment 7 Stefan Hansel 2009-12-14 14:59:47 UTC
Ben, before I accept this being closed as invalid, please answer the following questions:


- why isn't it considered a bug, that when I go to 'Settings->Screen->Date & Time->Date Format' I only see unlocalized strings ?
- how can I get a localized version of the long date format then ?
   (jive.utils.datetime returns unlocalized strings)
- what is a long date format useful for, when I can't get a localized string ?
Comment 8 Ben Klaas 2009-12-14 15:15:20 UTC
Michael, only assigning to you as a flag for us to discuss further.


Apologies, will leave the bug open. There are many conflicting comments in the description here.

yes, os.date() does not return localized strings.

In the ClockApplet we do localization with a strings file based on what's returned from misc os.date() calls

e.g., Lua:
        -- string month of year
        local monthOfYear = os.date("%m")
        token = "SCREENSAVER_CLOCK_MONTH_" .. tostring(monthOfYear)
        local monthString = self.applet:string(token)
        widget = self.dateGroup:getWidget('month')
        widget:setValue(monthString)

the token then uses values from the strings file to display the localized text:

SCREENSAVER_CLOCK_MONTH_12
        CS      Prosinec
        DA      december
        DE      Dezember
        EN      December
        ES      Diciembre
        FI      Joulukuu
        FR      Décembre
        IT      Dicembre
        NL      december
        NO      desember
        PL      Grudzień
        RU      Декабрь
        SV      december

This is not a solution, but one could poach strings from ClockApplet/strings.txt to make this work better. Of course, this will likely launch a firestorm of license discussion again :-/
Comment 9 Michael Herger 2009-12-14 22:40:53 UTC
Ben - as I doubt we'll ever add full locale support for its size, could we make os.date do the "localization" based on our strings? It's not too many tokens we'd need, and we already have a lot of them.
Comment 10 Erland Isaksson 2010-02-23 22:15:27 UTC
It would be great if os.date supported localization but I'll add similar support as the standard clocks in my Custom Clock applet in the meanwhile. So you don't have to prioritize this based on the Custom Clock applet.
Comment 11 Stefan Hansel 2010-02-23 23:32:17 UTC
I'll still suffer from it in the weather-applet (and don't want to copy the localization code erland might write around)
Comment 12 SVN Bot 2010-02-24 06:35:05 UTC
 == Auto-comment from SVN commit #8564 to the  repo by mherger ==
 == https://svn.slimdevices.com/?view=revision&revision=8564 ==

Fixed Bug: 14538
Description: add jive.utils.datetime:getCurrentDate() method to get localized date string. Please use this instead of os.date() if you want a localized and formatted date string as defined in the settings.

Don't show the confusing formatting string in the date settings, but only localized date instead.
Comment 13 Michael Herger 2010-02-24 06:37:45 UTC
local datetime = require("jive.utils.datetime")
...
local date = datetime:getCurrentDate()

-- You can optionally pass your own format string if you prefer
date = datetime:getCurrentDate("%d/%B/%Y")
Comment 14 Michael Herger 2010-02-24 06:41:47 UTC
Oh, I should add that there's no localization but for German right now. Translators will complete soon.
Comment 15 SVN Bot 2010-02-25 14:54:32 UTC
 == Auto-comment from SVN commit #8564 to the  repo by mherger ==
 == https://svn.slimdevices.com/?view=revision&revision=8564 ==

Fixed Bug: 14538
Description: add jive.utils.datetime:getCurrentDate() method to get localized date string. Please use this instead of os.date() if you want a localized and formatted date string as defined in the settings.

Don't show the confusing formatting string in the date settings, but only localized date instead.
Comment 16 SVN Bot 2010-02-25 15:03:30 UTC
 == Auto-comment from SVN commit #8564 to the jive repo by mherger ==
 == https://svn.slimdevices.com/jive?view=revision&revision=8564 ==

Fixed Bug: 14538
Description: add jive.utils.datetime:getCurrentDate() method to get localized date string. Please use this instead of os.date() if you want a localized and formatted date string as defined in the settings.

Don't show the confusing formatting string in the date settings, but only localized date instead.
Comment 17 Chris Owens 2010-04-08 17:26:41 UTC
This bug has been marked fixed in a released version of Squeezebox Server or the accompanying firmware or mysqueezebox.com release.

If you are still seeing this issue, please let us know!