There is a “code” for language (English, Spanish, etc…) not defined?
-
28-05-2021 - |
Question
In my application there is language detection. Languages have some identification code like en for English, pt for Portuguese, fr for French, etc.
Is there a language code for the case when a language cannot be identified (unknown language)?
Solution
The language codes you're using look like ISO 639-1. There is no ISO 639-1 code for an indeterminate or unknown language; however, "xx" could be used as as a reasonable placeholder.
OTHER TIPS
If your system allows for three-letter codes, the ISO 639-2 standard says:
If there is language content, but the specific language cannot be determined, a special identifier is provided by ISO 639-2:
und (Undetermined)
You probably know it already, but at least for the benefit of others who may look your question up later:
In C, C++ and Unix/Linux generally, and sometimes elsewhere, there is something that goes by the cryptic name of "the C locale." This is really the absence of a locale, which is to say, the absence of a set of language- and country-related conventions. In the C locale, text is sorted in straight character-code (usually ASCII) order, which means that "ABC" precedes "XYZ" precedes "abc" precedes "xyz."
One needn't specify any code at all to get the C locale. It has no code -- a significant fact which is at least tangentially related to your question.