canonicalize

Function canonicalize 

pub fn canonicalize<S>(input: S) -> Result<String, LanguageIdentifierError>
where S: AsRef<[u8]>,
Available on crate feature i18n only.
Expand description

This is a best-effort operation that performs all available levels of canonicalization.

At the moment the operation will normalize casing and the separator, but in the future it may also validate and update from deprecated subtags to canonical ones.

ยงExamples

use unic_langid_impl::canonicalize;

assert_eq!(canonicalize("pL_latn_pl"), Ok("pl-Latn-PL".to_string()));