[TASK] Properly select Chinese (Simplified) in DatePicker.js 61/51161/3
authorDavid Wong <noreply@example.com>
Fri, 6 Jan 2017 08:02:51 +0000 (09:02 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 7 Feb 2018 12:36:28 +0000 (13:36 +0100)
The language identifier key for Chinese in TYPO3s backend is ‘ch’.
The valid identifier should be ‘zh-cn’, but we cannot change the entire translation server
in a meaningful way.

Releases: master
Resolves: #79179
Change-Id: I5fee14f2eceacc5676588bdb8cac2aeceb88fff6
Reviewed-on: https://review.typo3.org/51161
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Resources/Public/JavaScript/DateTimePicker.js

index f3f258b..4332626 100644 (file)
@@ -44,6 +44,10 @@ define(['jquery'], function($) {
     if ($dateTimeFields.length > 0) {
       require(['moment', 'TYPO3/CMS/Backend/Storage/Persistent', 'twbs/bootstrap-datetimepicker'], function(moment, PersistentStorage) {
         var userLocale = PersistentStorage.get('lang');
+        // Fix our made up locale "ch"
+        if (userLocale === 'ch') {
+          userLocale = 'zh-cn';
+        }
         var setLocale = userLocale ? moment.locale(userLocale) : false;
 
         // initialize the datepicker on each selected element