GettextTranslator.Util.PathHelper (gettext_translator v0.2.0)
View SourceHelper functions for working with PO and changelog file paths.
Summary
Functions
Gets the changelog path corresponding to a PO file.
Ensures the translation_changelog directory exists.
Extracts the domain from a PO file path.
Extracts the language code from a PO file path.
Gets the source PO file path from a changelog path.
Functions
Gets the changelog path corresponding to a PO file.
Examples
iex> changelog_path_for_po("priv/gettext/uk/LC_MESSAGES/default.po")
"priv/translation_changelog/uk_default_changelog.json"
Ensures the translation_changelog directory exists.
Extracts the domain from a PO file path.
Examples
iex> extract_domain("priv/gettext/uk/LC_MESSAGES/default.po")
"default"
Extracts the language code from a PO file path.
Examples
iex> extract_language_code("priv/gettext/uk/LC_MESSAGES/default.po")
"uk"
Gets the source PO file path from a changelog path.
Examples
iex> po_path_for_changelog("priv/translation_changelog/uk_default_changelog.json")
"priv/gettext/uk/LC_MESSAGES/default.po"