Nat 96939b7aee | ||
---|---|---|
.. | ||
lib | ||
src | ||
.fetch | ||
.formatter.exs | ||
.hex | ||
CHANGELOG.md | ||
LICENSE | ||
README.md | ||
hex_metadata.config | ||
mix.exs |
README.md
Expo
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.
Usage
Expo can parse PO, POT, and MO files from GNU gettext:
Expo.PO.parse_file!("priv/gettext/default.pot")
#=> %Expo.Messages{...}
It can also write well-formed PO, POT, and MO files:
"priv/gettext/default.pot"
|> 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
License
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.