@Test public void testKeys() { for( String lang : TranslationBundle.LANGUAGES ) { ResourceBundle rb = new TranslationBundle( lang ); for( ErrorCode ec : ErrorCode.values()) { try { String s = rb.getString( ec.name()); Assert.assertNotNull( lang, s ); } catch( MissingResourceException e ) { Assert.fail( lang + " => " + ec.name()); } } for( ErrorDetailsKind detailsKind : ErrorDetailsKind.values()) { try { String s = rb.getString( detailsKind.name()); Assert.assertNotNull( lang, s ); } catch( MissingResourceException e ) { Assert.fail( lang + " => " + detailsKind.name()); } } try { String s = rb.getString( DETAILS_SEPARATOR ); Assert.assertNotNull( lang, s ); } catch( MissingResourceException e ) { Assert.fail( lang + " => " + DETAILS_SEPARATOR ); } Assert.assertEquals( lang, ErrorDetailsKind.values().length + ErrorCode.values().length + 1, ((TranslationBundle) rb).getContents().length ); } }
@Override protected Object[][] getContents() { Map<String,String> map = loadContent( this.lang ); Object[][] result = new Object[ map.size()][ 2 ]; int i = 0; for( Map.Entry<String,String> entry : map.entrySet()) { result[ i ][ 0 ] = entry.getKey(); result[ i ][ 1 ] = entry.getValue(); i++; } return result; }
TranslationBundle extends ListResourceBundle { @Override protected Object[][] getContents() { Map<String,String> map = loadContent( this.lang ); Object[][] result = new Object[ map.size()][ 2 ]; int i = 0; for( Map.Entry<String,String> entry : map.entrySet()) { result[ i ][ 0 ] = entry.getKey(); result[ i ][ 1 ] = entry.getValue(); i++; } return result; } }
TranslationBundle extends ListResourceBundle { @Override protected Object[][] getContents() { Map<String,String> map = loadContent( this.lang ); Object[][] result = new Object[ map.size()][ 2 ]; int i = 0; for( Map.Entry<String,String> entry : map.entrySet()) { result[ i ][ 0 ] = entry.getKey(); result[ i ][ 1 ] = entry.getValue(); i++; } return result; } TranslationBundle( String lang ); }
TranslationBundle extends ListResourceBundle { @Override protected Object[][] getContents() { Map<String,String> map = loadContent( this.lang ); Object[][] result = new Object[ map.size()][ 2 ]; int i = 0; for( Map.Entry<String,String> entry : map.entrySet()) { result[ i ][ 0 ] = entry.getKey(); result[ i ][ 1 ] = entry.getValue(); i++; } return result; } TranslationBundle( String lang ); String getLang(); static String resolve( String lang ); }
TranslationBundle extends ListResourceBundle { @Override protected Object[][] getContents() { Map<String,String> map = loadContent( this.lang ); Object[][] result = new Object[ map.size()][ 2 ]; int i = 0; for( Map.Entry<String,String> entry : map.entrySet()) { result[ i ][ 0 ] = entry.getKey(); result[ i ][ 1 ] = entry.getValue(); i++; } return result; } TranslationBundle( String lang ); String getLang(); static String resolve( String lang ); static final String DETAILS_SEPARATOR; static final String EN; static final String FR; }