tp.Languages and tp.Cultures

tp.Language and tp.Languages are about user-interface text. A language stores string resources keyed by name, and the current language is used by tp._L() and tp.Res.GetString(). This is localization.

tp.Culture and tp.Cultures are about formatting information: decimal separator, thousand separator, currency symbol, date separator, date format, day names, and month names. This is globalization. A page may use Greek UI text with an English culture, or English UI text with a Greek culture, so the two concepts are deliberately separate.

Language resources

The demo adds a few resource strings to the built-in English and Greek languages, then switches tp.Languages.Current.

Title

Message

Current culture

The current culture is available through tp.Cultures.Current and shortcut properties such as tp.DecimalSeparator, tp.DateFormat, and tp.CurrencySymbol.

Culture

Number separators

Date format

Currency

Lookup helpers

tp.Languages.Find(), tp.Languages.Exists(), tp.Cultures.Find(), and tp.Cultures.Ensure() are registry helpers. Ensure() creates a culture when it is not already registered.

Callback resource access

tp.Res.GetString() returns a localized resource through a callback. The callback also receives a user tag, which is useful when the same callback is used for many resource keys.