I posted a question asking whether Shindig Java currently support any
internationalization, and haven't heard back from anyone. Based on what
I've seen in the code so far, I assume that there's none and would like to
propose the following:
We found that java.util.logging.Logger.logp() provides enough support for
logging messages on Shindig Java side entailing its origin such as class
name, method name, and message key for translation/subtitution, etc.
Phase1- Adding translation for existing log INFO and log WARN using
java.util.logging.Logger.logp()
For each module shindig-common, shindig-gadgets, shindig-samples, and
shindig-social-api
1. Add a new Java package and new interface
org.apache.shindig.logging.i18n.LoggingKeys Interface to centralize all
message keys including the message resource bundle in one place.
2. Add org.apache.shindig.logging.i18n in java/resources, then add
resource bundle messages.properties and its variation translation files
here.
3. Update Logger instantiation to load the message resource bundle. Ex:
Logger.getLogger(classname,LoggingKeys.MESSAGES);//where MESSAGES="
org.apache.shindig.logging.i18n.messages" defined in step 1
4. Update all existing INFO and WARNING messages to use the supported
logp() APIs for localization, we should also check for the log level
before invoking logp(). For example:
if (logger.isLoggable(Level.INFO)) {
logger.logp(Level.INFO, classname, methodname, LoggingKeys.
A_MESSAGE_KEY);
}
5. We'll try to do a few language translation for the messages.properties,
and need help with the rest.
Phase 2 - Adding log FINER for major method entries and exits to aid with
debugging following similar pattern in step 4 which is checking for
logging level before invoking the log method.
We don't think there's any need to add i18n support for debug logging.
if (logger.isLoggable(Level.FINER)) logger.entering(className,
"mymethod(input params)");
OR
if (logger.isLoggable(Level.FINER)) logger.exiting(className,
"mymethod(input params)");
Although this enhancement touches a lot of code, it will not likely change
any functionality of the code.
Please provide feedbacks because we'd like to have your agreement and
support on a common logging pattern to help better support Shindig code
base.
If there're no objections I will open a JIRA to track our progress by the
end of the week.
Thanks,
Han