Function: builtInValidationLanguage()
builtInValidationLanguage(
language):string|undefined
The built-in messages language closest to a language tag: the same tag (compared case-insensitively, _ read as -); for Chinese, the one of its script or region (zh-Hant, zh-HK, zh-MO: zh-TW; zh, zh-Hans, zh-SG: zh-CN); otherwise the built-in one of the same primary language (pt-PT: pt-BR, en-GB: en).
Parameters
language
string
A language tag, like pt_PT or the Accept-Language value of a request.
Returns
string | undefined
One of BUILT_IN_VALIDATION_LANGUAGES, or undefined for a language without built-in messages.
Example
typescript
import {builtInValidationLanguage} from 'lakutata'
console.log(builtInValidationLanguage('zh-HK')) //zh-TW
console.log(builtInValidationLanguage('pt_PT')) //pt-BR
console.log(builtInValidationLanguage('sv')) //undefined