Discussion:
cool components and locale
Theodore Petrosky
2018-09-27 23:39:24 UTC
Permalink
CCDatePicker is set up to use the locale and if it is en_US the calendars it creates start on Sunday!

in CCDatePicker I see:
String langScript = ERXLocalizer.currentLocalizer().languageCode() + ".js”;

when I stick in a log I see that ERXLocalizer is returning “en” when it should be “en_US”

If I use the Java Locale class
Locale locale = Locale.getDefault();

in this case locale “en_US”

and the calendars that popup indeed have Sunday as the first day of the week!

I don’t understand why ERXLocalizer.currentLocalizer().languageCode() + ".js”; does not return “en_US”

Is there anything bad that would happen if I use the Java Locale locale = Locale.getDefault(); to get the locale?

Basically I am suggesting in CCDatePicker.java:

@Override
public void appendToResponse(WOResponse response, WOContext context)
{
if (booleanValueForBinding("injectStylesheet")) {
String framework = stringValueForBinding("cssFramework", FRAMEWORK_NAME);
String cssFilename = stringValueForBinding("cssFile", CSS_FILENAME);
ERXResponseRewriter.addStylesheetResourceInHead(response, context, framework, cssFilename);
}
String datepickerjsName = ERXApplication.isDevelopmentModeSafe() ? "datepicker_lg.js" : "datepicker.js";
ERXResponseRewriter.addScriptResourceInHead(response, context, FRAMEWORK_NAME, datepickerjsName);
// String langScript = ERXLocalizer.currentLocalizer().languageCode() + ".js";
Locale locale = Locale.getDefault();
String langScript = locale + ".js";

ERXResponseRewriter.addScriptResourceInHead(response, context, FRAMEWORK_NAME, "lang/" + langScript);

super.appendToResponse(response, context);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-***@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/uoh8%40ml-in.narkive.net

This email sen

Loading...