Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Chinese calendar js files to lowercase #19659

Closed
wants to merge 1 commit into from

Conversation

infograf768
Copy link
Member

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?

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-staging labels Feb 13, 2018
@infograf768
Copy link
Member Author

The issue is present on LINUX systems.

@imanickam
Copy link
Contributor

imanickam commented Feb 13, 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

@infograf768
Copy link
Member Author

@dgrammatiko
Copy link
Contributor

@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

@infograf768
Copy link
Member Author

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

@infograf768
Copy link
Member Author

I am told it works. Making new PR

@infograf768
Copy link
Member Author

replacing by #19662

@infograf768 infograf768 deleted the chineselocale branch February 13, 2018 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants