Repository: flex-sdk Updated Branches: refs/heads/develop c5ad173d6 -> 930e912c8
FLEX-35106 fixed June and July abbreviations for French locale Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/930e912c Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/930e912c Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/930e912c Branch: refs/heads/develop Commit: 930e912c86d89b343de5b2377358e9e4626f9b67 Parents: c5ad173 Author: Justin Mclean <jmcl...@apache.org> Authored: Wed Jul 6 11:20:10 2016 +1000 Committer: Justin Mclean <jmcl...@apache.org> Committed: Wed Jul 6 11:20:10 2016 +1000 ---------------------------------------------------------------------- .../projects/mx/src/mx/controls/DateField.as | 34 +++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/930e912c/frameworks/projects/mx/src/mx/controls/DateField.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/mx/src/mx/controls/DateField.as b/frameworks/projects/mx/src/mx/controls/DateField.as index 6d45041..fd865b8 100644 --- a/frameworks/projects/mx/src/mx/controls/DateField.as +++ b/frameworks/projects/mx/src/mx/controls/DateField.as @@ -51,6 +51,7 @@ import mx.events.SandboxMouseEvent; import mx.managers.IFocusManagerComponent; import mx.managers.ISystemManager; import mx.managers.PopUpManager; +import mx.resources.Locale; import mx.resources.ResourceManager; import mx.styles.CSSStyleDeclaration; import mx.styles.StyleManager; @@ -428,6 +429,26 @@ public class DateField extends ComboBase // //-------------------------------------------------------------------------- + /** + * Return the short three letter name of a month. + * In most cases it's the first 3 letters. + * + * TODO move short names to resource bundles. + */ + protected static function shortMonthName(monthName:String, locale:Locale, monthNames:Array):String + { + if (locale && locale.language == "fr") { + if (monthName == monthNames[5]) { + return "JUN"; + } + else if (monthName == monthNames[6]) { + return "JUL"; + } + } + + return monthName.substr(0,3); + } + /** * Parses a String object that contains a date, and returns a Date * object corresponding to the String. @@ -475,13 +496,14 @@ public class DateField extends ComboBase if (valueString == null || inputFormat == null) return null; - var monthNames:Array = ResourceManager.getInstance() - .getStringArray("SharedResources", "monthNames"); - + var monthNames:Array = ResourceManager.getInstance().getStringArray("SharedResources", "monthNames"); var noMonths:int = monthNames.length; + var locales:Array = ResourceManager.getInstance().localeChain; + var locale:Locale = new Locale(locales[0]); + for (var i:int = 0; i < noMonths; i++) { valueString = valueString.replace(monthNames[i], (i+1).toString()); - valueString = valueString.replace(monthNames[i].substr(0,3), (i+1).toString()); + valueString = valueString.replace(shortMonthName(monthNames[i], locale, monthNames), (i+1).toString()); } length = valueString.length; @@ -674,7 +696,9 @@ public class DateField extends ComboBase } else if (fullMask == "MMM") { - output += monthNames[value.getMonth()].substr(0,3); + var locales:Array = ResourceManager.getInstance().localeChain; + var locale:Locale = new Locale(locales[0]); + output += shortMonthName(monthNames[value.getMonth()], locale, monthNames); } else if (fullMask == "MMMM") {