private static void addSuffixIfAvailable ( String messageBundlePath , Set < String > availableLocaleSuffixes , Locale locale , String fileSuffix , ServletContext servletContext ) { String localMsgResourcePath = toBundleName ( messageBundlePath , locale ) + fileSuffix ; URL resourceUrl = getResourceBundleURL ( localMsgResourcePath , servletContext ) ; if ( resourceUrl != null ) { String suffix = localMsgResourcePath . substring ( messageBundlePath . length ( ) ) ; if ( suffix . length ( ) > 0 ) { if ( suffix . length ( ) == fileSuffix . length ( ) ) { suffix = "" ; } else { // remove the "_" before the suffix "_en_US" => "en_US" suffix = suffix . substring ( 1 , suffix . length ( ) - fileSuffix . length ( ) ) ; } } availableLocaleSuffixes . add ( suffix ) ; } }
Adds the locale suffix if the message resource bundle file exists .