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, or does not have the correct plural for the given n, the given plural message is returned.

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