protected String toLocaleString ( Locale locale ) { String language = locale . getLanguage ( ) ; if ( language . isEmpty ( ) ) return "" ; String country = locale . getCountry ( ) ; if ( country . isEmpty ( ) ) return language ; String variant = locale . getVariant ( ) ; if ( variant . isEmpty ( ) ) { return language + ' ' + country ; } else { return language + ' ' + country + ' ' + variant ; } }
Gets a string representation of the given locale . This default implementation only supports language country and variant . Country will only be added when language present . Variant will only be added when both language and country are present .