GettextTranslator.Util.PathHelper (gettext_translator v0.4.2)
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.
Returns the appropriate gettext directory path.
Gets the source PO file path from a changelog path.
Returns the appropriate translation changelog directory path.
Functions
Gets the changelog path corresponding to a PO file.
Examples
iex> changelog_path_for_po("priv/gettext/uk/LC_MESSAGES/default.po", :my_app)
"/path/to/my_app/priv/translation_changelog/uk_default_changelog.json"
Ensures the translation_changelog directory exists.
Examples
iex> ensure_changelog_dir(:my_app)
:ok
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"
Returns the appropriate gettext directory path.
Examples
iex> gettext_dir(:my_app)
"/path/to/my_app/priv/gettext"
Gets the source PO file path from a changelog path.
Examples
iex> po_path_for_changelog("priv/translation_changelog/uk_default_changelog.json", :my_app)
"/path/to/my_app/priv/gettext/uk/LC_MESSAGES/default.po"
Returns the appropriate translation changelog directory path.
Examples
iex> translation_changelog_dir(:my_app)
"/path/to/my_app/priv/translation_changelog"