Java Locale - getISO3Language() Method
The java.util.Locale.getISO3Language() method returns a three-letter abbreviation of this locale's language. If the language matches an ISO 639-1 two-letter code, the corresponding ISO 639-2/T three-letter lowercase code is returned. If the locale specifies a three-letter language, the language is returned as is. If the locale does not specify a language the empty string is returned.
Syntax
public String getISO3Language() throws MissingResourceException
Parameters
No parameter is required.
Return Value
Returns a three-letter abbreviation of this locale's language.
Exception
Throws MissingResourceException, if three-letter language abbreviation is not available for this locale.
Example:
In the example below, the java.util.Locale.getISO3Language() method is used to get a three-letter abbreviation of the given locale's language.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating a locale Locale loc = new Locale("EN", "UK"); //printing the locale System.out.println("loc is: " + loc); //printing the language of the locale System.out.println("Language is: " + loc.getISO3Language()); } }
The output of the above code will be:
loc is: en_UK Language is: eng
❮ Java.util - Locale