Author: jleroux
Date: Thu Oct 13 13:51:37 2011 New Revision: 1182858 URL: http://svn.apache.org/viewvc?rev=1182858&view=rev Log: JQuery team does not care about plugins consistency, so we have to be careful. For instance, for more fun: in validate plugin we have also ptpt and ptbr... Just found by chance while looking for consistency in JsLanguageFileMappingCreator class after refactoring Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFileMappingCreator.java ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFilesMapping.java Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFileMappingCreator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFileMappingCreator.java?rev=1182858&r1=1182857&r2=1182858&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFileMappingCreator.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFileMappingCreator.java Thu Oct 13 13:51:37 2011 @@ -52,8 +52,10 @@ public class JsLanguageFileMappingCreato for (Locale locale : localeList) { String displayCountry = locale.toString(); String modifiedDisplayCountry = null; + String modifiedDisplayCountryForValidation = null; if (displayCountry.indexOf('_') != -1) { modifiedDisplayCountry = displayCountry.replace("_", "-"); + modifiedDisplayCountryForValidation = displayCountry.replace("_", "").toLowerCase(); // fun: in validate plugin we have also ptpt and ptbr for instance... } else { modifiedDisplayCountry = displayCountry; } @@ -90,11 +92,19 @@ public class JsLanguageFileMappingCreato */ fileName = componentRoot + validateRelPath + validateLocalePrefix + strippedLocale + jsFilePostFix; file = FileUtil.getFile(fileName); + if (file.exists()) { fileUrl = validateRelPath + validateLocalePrefix + strippedLocale + jsFilePostFix; } else { - // use default language en - fileUrl = validateRelPath + validateLocalePrefix + defaultLocaleJquery + jsFilePostFix; + // Try to guess a language (fun: in validate plugin we have also ptpt and ptbr for instance....) + fileName = componentRoot + validateRelPath + validateLocalePrefix + modifiedDisplayCountryForValidation + jsFilePostFix; + file = FileUtil.getFile(fileName); + if (file.exists()) { + fileUrl = validateRelPath + validateLocalePrefix + modifiedDisplayCountryForValidation + jsFilePostFix; + } else { + // use default language en + fileUrl = validateRelPath + validateLocalePrefix + defaultLocaleJquery + jsFilePostFix; + } } validationLocaleFile.put(displayCountry, fileUrl); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFilesMapping.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFilesMapping.java?rev=1182858&r1=1182857&r2=1182858&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFilesMapping.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/JsLanguageFilesMapping.java Thu Oct 13 13:51:37 2011 @@ -28,7 +28,7 @@ import javolution.util.FastMap; public final class JsLanguageFilesMapping { // DO NOT EDIT THIS FILE! THIS IS AUTO GENERATED AND WILL GET WRITTEN OVER PERIODICALLY WHEN THE DATA CHANGE - // Rather use the createJsLanguageFileMapping to create or update it. You will still need to compile thereafter + // Rather use the createJsLanguageFileMapping service to create or update it. You will still need to compile thereafter public static class datejs { @@ -477,8 +477,8 @@ public final class JsLanguageFilesMappin localeFiles.put("pl", "/images/jquery/plugins/validate/localization/messages_pl.js"); localeFiles.put("pl_PL", "/images/jquery/plugins/validate/localization/messages_pl.js"); localeFiles.put("pt", "/images/jquery/plugins/validate/localization/messages_en.js"); - localeFiles.put("pt_BR", "/images/jquery/plugins/validate/localization/messages_en.js"); - localeFiles.put("pt_PT", "/images/jquery/plugins/validate/localization/messages_en.js"); + localeFiles.put("pt_BR", "/images/jquery/plugins/validate/localization/messages_ptbr.js"); + localeFiles.put("pt_PT", "/images/jquery/plugins/validate/localization/messages_ptpt.js"); localeFiles.put("ro", "/images/jquery/plugins/validate/localization/messages_ro.js"); localeFiles.put("ro_RO", "/images/jquery/plugins/validate/localization/messages_ro.js"); localeFiles.put("ru", "/images/jquery/plugins/validate/localization/messages_ru.js"); |
Free forum by Nabble | Edit this page |