kielet/database

The database contains all the loaded languages.

Types

pub opaque type Database

Functions

pub fn add_language(db: Database, lang: Language) -> Database

Add a language to the database.

pub fn new() -> Database

Create a new empty database.

pub fn translate_plural(
  db: Database,
  msgid: String,
  plural: String,
  n: Int,
  language_code: String,
) -> String

Translate a plural message using the database.

If the language is not found, does not have a translation for the message, does not have the correct plural for the given n, or does not have a plural forms header at all, the plural message given as the argument is returned instead.

pub fn translate_singular(
  db: Database,
  msgid: String,
  language_code: String,
) -> String

Translate a singular message using the database.

If the language is not found or does not have a translation for the message, the message is returned as-is.

Search Document