private int parseLanguage ( ) { int startLength = buffer . length ( ) ; if ( haveExperimentalLanguagePrefix ( ) ) { append ( AsciiUtil . toLower ( id [ 0 ] ) ) ; append ( HYPHEN ) ; index = 2 ; } char c ; while ( ! isTerminatorOrIDSeparator ( c = next ( ) ) ) { append ( AsciiUtil . toLower ( c ) ) ; } -- index ; // unget if ( buffer . length ( ) - startLength == 3 ) { String lang = LocaleIDs . threeToTwoLetterLanguage ( getString ( 0 ) ) ; if ( lang != null ) { set ( 0 , lang ) ; } } return 0 ; }
Advance index past language and accumulate normalized language code in buffer . Index must be at 0 when this is called . Index is left at a terminator or id separator . Returns the start of the language code in the buffer .