dp_intl 1.0.0
Gettext-compatible internationalization library for C++
dp::intl::LangTagFormat Struct Reference

The language tag format options for buildLangTag(). More...

#include <dp_intl/lang_tag_utils.h>

Public Types

enum class  Separator { Hyphen , Underscore }
 The separator to insert between subtags. More...
enum class  LetterCase { Upper , Lower , Bcp47 }
 The letter case for the tag. More...

Public Attributes

Separator separator {Separator::Underscore}
LetterCase letterCase {LetterCase::Bcp47}

Detailed Description

The language tag format options for buildLangTag().

The default LangTagFormat uses BCP 47 style letter case and underscores as separators to match the convention used by the Gettext library.

Member Enumeration Documentation

◆ Separator

The separator to insert between subtags.

buildLangTag() is designed to create tags compatible with the matchLang() function, so the separators are intentionally limited to hyphens and underscores.

Enumerator
Hyphen 
Underscore 

◆ LetterCase

The letter case for the tag.

LetterCase::Upper and LetterCase::Lower simply convert each subtag to upper and lowercase, respectively.

LetterCase::Bcp47 applies the case convention used by BCP 47 language tags, where all subtags are in lowercase with two exceptions: 2-letter and 4-letter subtags that neither appear at the start of the tag nor occur after 1-letter subtags. Such 2-letter subtags are in uppercase, and 4-letter subtags are in titlecase.

Enumerator
Upper 
Lower 
Bcp47 

Member Data Documentation

◆ separator

Separator dp::intl::LangTagFormat::separator {Separator::Underscore}

◆ letterCase

LetterCase dp::intl::LangTagFormat::letterCase {LetterCase::Bcp47}

The documentation for this struct was generated from the following file: