? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
13 Feb 2018

From @imanickam

The files zh-CN.js and zh-TW.js in the directory /media/system/js/fields/calendar-locales/ have to be renamed as zh-cn.js and zh-tw.js respectively. With the current file name, the calendar pop-up will not be in the native language (but in English).

On Siteground joomla demo sites, the Chinese calendar js files will not be used and it defaults to en-GB as their name contains Uppercase.

This patch corrects this.

Now, it also needs some changes in script.php, but I wonder how it will behave i.e. will it delete only the uppercase version?
@mbabker @dgt41

Maybe it would be better to change to lowercase through code when calling these js? That would avoid the possible issues with script.php.
What do you think?

avatar infograf768 infograf768 - open - 13 Feb 2018
avatar infograf768 infograf768 - change - 13 Feb 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Feb 2018
Category JavaScript Language & Strings
avatar infograf768
infograf768 - comment - 13 Feb 2018

The issue is present on LINUX systems.

avatar imanickam
imanickam - comment - 13 Feb 2018

Thanks JM!

In the Windows platform, one cannot encounter thie issue as the filenames are handled in case insensitive manner.

In the Linux platform, where the filenames are case sensitive, one would encounter this issue.

Please see the images tested on a Linux platform.

The testing was done with both the languages Chinese, Traditional (zh-TW) and Chinese, Simplified (zh-CN). The results are the same. For illustrative purpose, only the result of the language zh-TW is shown.

To test this, the Default Administrative Language has to be changed to changed to appropriate language. In this case it would be Chinese, Simplified (zh-CN).

Image 1: Before renaming the file zh-CN.js

calendar_popup_before_file_rename

Image 2: After renaming the file zh-CN.js to zh-cn.js

calendar_popup_after_file_rename

avatar dgt41
dgt41 - comment - 13 Feb 2018

@infograf768 for J4 I will automate this the same way I did for the installation error page, eg using the node build.js tools: https://github.com/joomla/joomla-cms/blob/4.0-dev/build/build-modules-js/installation.js. This means the files will get generated automatically through the ini files, so we rule out such bugs...
For J3 we need to somehow patch it

avatar infograf768
infograf768 - comment - 13 Feb 2018

I have asked Mig to test with this patch

diff --git a/libraries/joomla/form/fields/calendar.php b/libraries/joomla/form/fields/calendar.php
index 8ffb6d9..1987143 100644
--- a/libraries/joomla/form/fields/calendar.php
+++ b/libraries/joomla/form/fields/calendar.php
@@ -285,4 +285,8 @@
 			$localesPath = 'system/fields/calendar-locales/' . strtolower($tag) . '.js';
 		}
+		elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . $tag . '.js'))
+		{
+			$localesPath = 'system/fields/calendar-locales/' . $tag . '.js';
+		}
 		elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js'))
 		{
diff --git a/libraries/src/HTML/HTMLHelper.php b/libraries/src/HTML/HTMLHelper.php
index b13fe52..7b0ece4 100644
--- a/libraries/src/HTML/HTMLHelper.php
+++ b/libraries/src/HTML/HTMLHelper.php
@@ -1014,4 +1014,8 @@
 			$localesPath = 'system/fields/calendar-locales/' . strtolower($tag) . '.js';
 		}
+		elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . $tag . '.js'))
+		{
+			$localesPath = 'system/fields/calendar-locales/' . $tag . '.js';
+		}
 		elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js'))
 		{

Let's see if it works

avatar infograf768
infograf768 - comment - 13 Feb 2018

I am told it works. Making new PR

avatar infograf768
infograf768 - comment - 13 Feb 2018

replacing by #19662

avatar infograf768 infograf768 - close - 13 Feb 2018
avatar infograf768 infograf768 - change - 13 Feb 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-02-13 09:19:28
Closed_By infograf768
Labels Added: ? ?

Add a Comment

Login with GitHub to post a comment