public Optional < SoyMsgBundle > resolve ( final Optional < Locale > locale ) throws IOException { if ( ! locale . isPresent ( ) ) { return Optional . absent ( ) ; } synchronized ( msgBundles ) { SoyMsgBundle soyMsgBundle = null ; if ( isHotReloadModeOff ( ) ) { soyMsgBundle = msgBundles . get ( locale . get ( ) ) ; } if ( soyMsgBundle == null ) { soyMsgBundle = createSoyMsgBundle ( locale . get ( ) ) ; if ( soyMsgBundle == null ) { soyMsgBundle = createSoyMsgBundle ( new Locale ( locale . get ( ) . getLanguage ( ) ) ) ; } if ( soyMsgBundle == null && fallbackToEnglish ) { soyMsgBundle = createSoyMsgBundle ( Locale . ENGLISH ) ; } if ( soyMsgBundle == null ) { return Optional . absent ( ) ; } if ( isHotReloadModeOff ( ) ) { msgBundles . put ( locale . get ( ) , soyMsgBundle ) ; } } return Optional . fromNullable ( soyMsgBundle ) ; } }
Based on a provided locale return a SoyMsgBundle file .