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 XLRLocalizer( String path ) { findFiles( new File( path ), null ); }
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; }
public ILocalizedText getLocalizedText( Locale locale, String id ) { XLRMessageNode messageNode = (XLRMessageNode) nodedict.get( id ); XLRTargetNode targetNode = null; if (messageNode != null) { targetNode = messageNode.getTarget( locale.toString() ); } if (targetNode == null) { targetNode = checkLocales( locale, id ); } if (targetNode == null) { return null; } return new XLRLocalizedText( targetNode ); }
public XLRTargetNode loadNode( Locale fileLocale, String fileId, Locale locale, String id ) { String key = getKey( fileLocale, fileId ); XLRFile f = filedict.get( key ); if (f == null) { String resource = key.replaceAll( "\\.", "/" ) + ".xlr"; URL url = getClass().getClassLoader().getResource( resource ); if (url != null) { f = new XLRFile( fileId, url ); filedict.put( key, f ); } } if (f != null) { f.load(); XLRMessageNode messageNode = (XLRMessageNode) nodedict.get( id ); if (messageNode != null) { XLRTargetNode targetNode = messageNode.getTarget( locale.toString() ); return targetNode; } } return null; }
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; }
public ILocalizedText getLocalizedText( Locale locale, String id ) { XLRMessageNode messageNode = (XLRMessageNode) nodedict.get( id ); XLRTargetNode targetNode = null; if (messageNode != null) { targetNode = messageNode.getTarget( locale.toString() ); } if (targetNode == null) { targetNode = checkLocales( locale, id ); } if (targetNode == null) { return null; } return new XLRLocalizedText( targetNode ); }
public XLRTargetNode loadNode( Locale fileLocale, String fileId, Locale locale, String id ) { String key = getKey( fileLocale, fileId ); XLRFile f = filedict.get( key ); if (f == null) { String resource = key.replaceAll( "\\.", "/" ) + ".xlr"; URL url = getClass().getClassLoader().getResource( resource ); if (url != null) { f = new XLRFile( fileId, url ); filedict.put( key, f ); } } if (f != null) { 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 XLRLocalizer( String path ) { findFiles( new File( path ), null ); }
findFiles( files[i].getAbsoluteFile(), ((relative == null)? "":(relative + ".")) + files[i].getName() );
findFiles( files[i].getAbsoluteFile(), ((relative == null)? "":(relative + ".")) + files[i].getName() );