You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2015/11/05 11:37:08 UTC

tapestry-5 git commit: TAP5-1886: for Chinese locales use the last character as an abbreviation for the weekday

Repository: tapestry-5
Updated Branches:
  refs/heads/master 6a3faa357 -> b57f85559


TAP5-1886: for Chinese locales use the last character as an abbreviation for the weekday


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/b57f8555
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/b57f8555
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/b57f8555

Branch: refs/heads/master
Commit: b57f85559a380e393ba6478bcca542e7abdfd1bf
Parents: 6a3faa3
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Thu Nov 5 11:35:20 2015 +0100
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Thu Nov 5 11:36:40 2015 +0100

----------------------------------------------------------------------
 .../coffeescript/META-INF/modules/t5/core/datefield.coffee    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b57f8555/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
index 9a9f63d..02ed397 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
@@ -32,7 +32,12 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
     days.push days.shift()
 
     monthsLabels = (messages "date-symbols.months").split ","
-    daysLabels = _.map days, (name) -> name.substr(0, 1).toLowerCase()
+    abbreviateWeekDay = (name) -> name.substr(0, 1).toLowerCase()
+    locale = (document.documentElement.getAttribute("data-locale")) || "en"
+    if locale.indexOf 'zh' is 0
+      # TAP5-1886, Chinese weekdays cannot be abbreviated using the first character
+      abbreviateWeekDay = (name) -> name.substr(name.length-1)
+    daysLabels = (abbreviateWeekDay name for name in days)
     todayLabel = messages "core-datefield-today"
     noneLabel = messages "core-datefield-none"