Code example for Locale

Methods: getCountry, getLanguage, getVariant, toString

0
f.load();
            XLRMessageNode messageNode = (XLRMessageNode) nodedict.get( id );
            if (messageNode != null)
            { 
                XLRTargetNode targetNode = messageNode.getTarget( locale.toString() );
                return targetNode;
            } 
        } 
 
        return null; 
    } 
 
    public XLRTargetNode checkPrefix( Locale fileLocale, String fileId, Locale locale, String id )
    { 
        XLRTargetNode t = loadNode( fileLocale, fileId, locale, id );
        if (t == null)
        { 
            int sep = fileId.lastIndexOf( '$' );
 
            if (sep == -1)
                sep = fileId.lastIndexOf( '.' );
 
            if (sep != -1)
                t = checkPrefix( fileLocale, fileId.substring( 0, sep ), locale, id );
        } 
        return t;
    } 
 
    public XLRTargetNode checkLocales( Locale locale, String id )
    { 
        XLRTargetNode t = checkPrefix( locale, id, locale, id );
 
        if ((t == null) && (locale.getCountry().length() > 0) && (locale.getVariant().length() > 0))
            t = checkPrefix( new Locale( locale.getLanguage(), locale.getCountry() ), id, locale, id );
 
        if ((t == null) && (locale.getCountry().length() > 0))
            t = checkPrefix( new Locale( locale.getLanguage() ), id, locale, id );
 
        if ((t == null))
            t = checkPrefix( null, id, locale, id );
 
        return t;