Author: mherger
Date: Wed May 12 05:47:02 2010
New Revision: 8768
URL: http://svn.slimdevices.com/jive?rev=8768&view=rev
Log:
Bug: 15439
Description: set reasonable localized defaults for date/time formats, based on
language and timezone information
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeMeta.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/strings.txt
7.6/trunk/squeezeplay/src/squeezeplay_baby/share/applets/SetupWelcome/SetupWelcomeApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupWelcome/SetupWelcomeApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupWelcome/SetupWelcomeApplet.lua
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeApplet.lua?rev=8768&r1=8767&r2=8768&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeApplet.lua
Wed May 12 05:47:02 2010
@@ -20,6 +20,7 @@
local ipairs, pairs, io, string, tostring = ipairs, pairs, io, string, tostring
local oo = require("loop.simple")
+local squeezeos = require("squeezeos_bsp")
local Applet = require("jive.Applet")
local Choice = require("jive.ui.Choice")
@@ -244,6 +245,39 @@
return self:getSettings()
end
+-- service callback to allow other applets to set default formats depending on
language and time zone
+function setDateTimeDefaultFormats(self)
+ local tz = tostring(squeezeos.getTimezone())
+ local lang = locale:getLocale()
+ log:debug("Using language (", lang, ") and time zone (", tz, ") to
determine date/time default formats")
+
+ -- default to 12h display for some select countries (EN speaking in
some countries)
+ -- see http://en.wikipedia.org/wiki/12-hour_clock#Use_by_country &
SetupTZApplet.lua
+ if tostring(lang) == 'EN' and (
+ string.match(tz, "^America")
+ or string.match(tz, "^Australia")
+ or string.match(tz, "^Pacific") -- New Zealand
+-- or string.match(tz, "^Asia/Calcutta") -- India/Pakistan
+-- or string.match(tz, "^Asia/Kabul")
+ ) then
+ self:setHours("12")
+ else
+ self:setHours("24")
+ end
+
+
self:setDateFormat(tostring(self:string("DATETIME_LONGDATEFORMAT_DEFAULT")) or
"%a %d %b %Y")
+
self:setShortDateFormat(tostring(self:string("DATETIME_SHORTDATEFORMAT_DEFAULT"))
or "%m.%d.%Y")
+
+ -- make US customers use Monday as the week start
+ if tostring(lang) == 'EN' and string.match(tz, "^America") then
+ self:setWeekStart("Monday")
+ else
+ self:setWeekStart("Sunday")
+ end
+
+ self:storeSettings()
+end
+
--[[
=head1 LICENSE
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeMeta.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeMeta.lua?rev=8768&r1=8767&r2=8768&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeMeta.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/SetupDateTimeMeta.lua
Wed May 12 05:47:02 2010
@@ -58,6 +58,7 @@
initDateTimeObject(meta)
meta:registerService("setupDateTimeSettings")
+ meta:registerService("setDateTimeDefaultFormats")
-- Menu for configuration
jiveMain:addItem(meta:menuItem('appletSetupDateTime',
'screenSettings', "DATETIME_TITLE", function(applet, ...)
applet:settingsShow(...) end))
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/strings.txt
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/strings.txt?rev=8768&r1=8767&r2=8768&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/strings.txt
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SetupDateTime/strings.txt
Wed May 12 05:47:02 2010
@@ -136,3 +136,34 @@
RU ÐоÑкÑеÑенÑе
SV Söndag
+DATETIME_LONGDATEFORMAT_DEFAULT
+# SLT: a long date format description, eg. "Montag, 22. Oktober 2009"
([[http://www.opengroup.org/onlinepubs/009695399/functions/strptime.html]])
+ CS %d. %B %Y
+ DA %d. %B %Y
+ DE %a, %d. %b, %Y
+ EN %a %d %b %Y
+ ES %a, %d %b, %Y
+ FI %d. %B %Y
+ FR %a %d %b %Y
+ IT %a %d %b %Y
+ NL %a %d %b %Y
+ NO %d. %B %Y
+ PL %d %B %Y
+ RU %d %B %Y
+ SV %d %B %Y
+
+DATETIME_SHORTDATEFORMAT_DEFAULT
+# SLT: a short date format description, eg. 22.10.2009
([[http://www.opengroup.org/onlinepubs/009695399/functions/strptime.html]])
+ CS %d.%m.%Y
+ DA %d.%m.%Y
+ DE %d.%m.%Y
+ EN %m.%d.%Y
+ ES %d.%m.%Y
+ FI %d.%m.%Y
+ FR %d.%m.%Y
+ IT %d.%m.%Y
+ NL %d.%m.%Y
+ NO %d.%m.%Y
+ PL %d.%m.%Y
+ RU %d.%m.%Y
+ SV %d.%m.%Y
Modified:
7.6/trunk/squeezeplay/src/squeezeplay_baby/share/applets/SetupWelcome/SetupWelcomeApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_baby/share/applets/SetupWelcome/SetupWelcomeApplet.lua?rev=8768&r1=8767&r2=8768&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay_baby/share/applets/SetupWelcome/SetupWelcomeApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay_baby/share/applets/SetupWelcome/SetupWelcomeApplet.lua
Wed May 12 05:47:02 2010
@@ -436,7 +436,7 @@
log:info("squeezenetwork pin=", pin, " url=", url)
if force then
- log:info("firmware upgrade from SN")
+ log:info("firmware upgrade from SN")
appletManager:callService("firmwareUpgrade", squeezenetwork)
else
self:_registerRequest(squeezenetwork)
@@ -590,6 +590,7 @@
function free(self)
+ appletManager:callService("setDateTimeDefaultFormats")
return not self.locked
end
Modified:
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupWelcome/SetupWelcomeApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupWelcome/SetupWelcomeApplet.lua?rev=8768&r1=8767&r2=8768&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupWelcome/SetupWelcomeApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupWelcome/SetupWelcomeApplet.lua
Wed May 12 05:47:02 2010
@@ -599,6 +599,7 @@
function free(self)
+ appletManager:callService("setDateTimeDefaultFormats")
return not self.locked
end
Modified:
7.6/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupWelcome/SetupWelcomeApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupWelcome/SetupWelcomeApplet.lua?rev=8768&r1=8767&r2=8768&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupWelcome/SetupWelcomeApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SetupWelcome/SetupWelcomeApplet.lua
Wed May 12 05:47:02 2010
@@ -676,6 +676,7 @@
function free(self)
+ appletManager:callService("setDateTimeDefaultFormats")
return not self.locked
end
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins