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

Date::getInputFormat should support localization #872

Closed
Toflar opened this issue Jun 13, 2017 · 3 comments
Closed

Date::getInputFormat should support localization #872

Toflar opened this issue Jun 13, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@Toflar
Copy link
Member

Toflar commented Jun 13, 2017

I guess this should do it:

diff --git a/src/Resources/contao/library/Contao/Date.php b/src/Resources/contao/library/Contao/Date.php
index 4efca5e..5b2578f 100644
--- a/src/Resources/contao/library/Contao/Date.php
+++ b/src/Resources/contao/library/Contao/Date.php
@@ -297,6 +297,17 @@ class Date
 			's' => 'ss',
 		);
 
+		if (isset($GLOBALS['TL_LANG']['INPUT_FORMAT_MAPPER']))
+		{
+			foreach (array_keys($arrCharacterMapper) as $from)
+			{
+				if (isset($GLOBALS['TL_LANG']['INPUT_FORMAT_MAPPER'][$from]))
+				{
+					$arrCharacterMapper[$from] = $GLOBALS['TL_LANG']['INPUT_FORMAT_MAPPER'][$from];
+				}
+			}
+		}
+
 		$arrInputFormat = array();
 		$arrCharacters = str_split($strFormat);
 
@leofeyer leofeyer added this to the 4.5.0 milestone Jun 13, 2017
@leofeyer
Copy link
Member

I assume that I also have to create $GLOBALS['TL_LANG']['INPUT_FORMAT_MAPPER']? Or is everyone supposed to do so by themselves?

@Toflar
Copy link
Member Author

Toflar commented Nov 21, 2017

Well, the current - hardcoded - way is the English format I suppose. You can also put the whole $arrCharacterMapper array to the English language files, yes.

@leofeyer
Copy link
Member

Implemented in 907f42f.

leofeyer added a commit that referenced this issue Dec 4, 2019
Description
-----------

Fixes #872

Commits
-------

3f3e15fa Fix the page type descriptions (see #872)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants