View Source Expo badge Documentation badge .github/workflows/branch_main.yml Coverage Status

Low-level GNU gettext file handling (for .po, .pot, and .mo files), including writing and parsing.

See the documentation.

For a full Gettext integration, see the Gettext library.


Expo can parse PO, POT, and MO files from GNU gettext:

#=> %Expo.Messages{...}

It can also write well-formed PO, POT, and MO files:

|> Expo.PO.parse_file!()
|> Expo.PO.compose()
|> then(fn content -> File.write!("priv/gettext/copy.pot") end)

This library can also parse Plural-Form headers in PO or POT files, and ships with a built-in list of languages and their plural forms. You can find which plural form to use for a given amount by using Expo.PluralForms.index/2:

{:ok, plural_form} = Expo.PluralForms.plural_form("de")

Expo.PluralForms.index(plural_form, 1)
#=> 0
Expo.PluralForms.index(plural_form, 213)
#=> 1


Copyright 2015 Plataformatec Copyright 2020 Dashbit 2022 JOSHMARTIN GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.