Mendeteksi bahasa string teks tertentu
=DETECTLANGUAGE(text)
| Parameter | Deskripsi |
|---|---|
text |
A sample of the language as a text string. |
The DETECTLANGUAGE figures the language for a given text string. The result from DETECTLANGUAGE is a short language code indicating the language. For
=DETECTLANGUAGE(text)
To use the DETECTLANGUAGE function, simply provide some text. For example, if we give DETECTLANGUAGE the word "apple", it "detects" English and return
=DETECTLANGUAGE("apple") // returns "en"
Likewise, if we give DETECTLANGUAGE the word for "apple" in four languages (French, Italian, German, and Spanish), it returns the four corresponding l
=DETECTLANGUAGE("pomme") // returns "fr"
=DETECTLANGUAGE("mela") // returns "it"
=DETECTLANGUAGE("Apfel") // returns "de"
=DETECTLANGUAGE("manzana") // returns "es"
In the worksheet below, we have text for "Is there a coffee shop around here?" in 12 languages. The goal is to determine the language codes based on t
=DETECTLANGUAGE(B5)
Then we can use the XLOOKUP function to get the correct language for a given code, as seen in column E of the worksheet below. The formula in cell E5
=XLOOKUP(D5,languages[Code],languages[Language])
If you want to look up the language name from the code in one step, you can combine the formulas above into one formula like this:
=XLOOKUP(DETECTLANGUAGE(B5),languages[Code],languages[Language])