← Back to team overview

dhis2-devs team mailing list archive

Getting Locale Code

 

Hi,

I am trying to apply jQuery Validation plugin into dhis2 india branch.

For showing the error messages in different languages, I need a language
code. But could not find this code anywhere. So what I did is adding this
method  into "I18n" class:

    public String getCurrentLocaleCode()
    {
        if( specificResourceBundle != null )
        {
            return specificResourceBundle.getLocale().getLanguage() + "_" +
specificResourceBundle.getLocale().getCountry();
        }
        if( globalResourceBundle != null )
        {
            return globalResourceBundle.getLocale().getLanguage() + "_" +
globalResourceBundle.getLocale().getCountry();
        }
        return null;
    }

So ... is  this a good way ? If not, please suggest me a better way.

And I can also apply this plugin to global branch if you want.

Thanks,

-- 
Nguyen Pham Hoang Quoc Viet

Follow ups