Poco::OSP

class LanguageTag

File Information

Library: OSP
Package: Util
Header: Poco/OSP/LanguageTag.h

Description

This class implements a RFC 1766 language tag.

A language tag describes a language and consists of a primary tag and one or more subtags. Usually, the primary tag conforms to an ISO 639 language code and the first subtag conforms to an ISO 3166 country code. For the details, please refer to RFC 1766.

In a string representation, primary and subtags are separated by '-', e.g., "en-US" or "de-AT".

Member Summary

Member Functions: primaryTag, subTags, toString

Constructors

LanguageTag

LanguageTag();

Creates a LanguageTag for the system's default language.

On Windows platform, the system's locale information is used. On Unix platform, the value of the environment variable LANG is used. If LANG is not defined, the default "en-US" is used.

LanguageTag

LanguageTag(
    const std::string & tag
);

Creates the LanguageTag from the tag given in the string argument.

LanguageTag

LanguageTag(
    const std::string & primaryTag,
    const std::string & subTags
);

Creates the LanguageTag from the given primary and sub tags.

Destructor

~LanguageTag

~LanguageTag();

Destroys the LanguageTag.

Member Functions

primaryTag inline

const std::string & primaryTag() const;

Returns the primary tag.

subTags inline

const std::string & subTags() const;

Returns all sub tags, delimited by a '-'.

toString

std::string toString() const;

Returns a string representation of the language tag.