Tools for working with translations of modulemd
Project description
# ModulemdTranslationHelpers
## Prerequisites
* [libmodulemd](https://github.com/fedora-modularity/libmodulemd)
* [koji](https://pagure.io/koji)
To install on Fedora 28+, run:
```
dnf install libmodulemd koji
```
## Installation
With the prerequisites installed, the latest version can be installed with
`pip install ModulemdTranslationHelpers` or on Fedora 28+ with `dnf install
python3-ModulemdTranslationHelpers` (recommended).
## CLI Usage
### Extract Translatable Strings
To extract translatable strings from modules for a particular Fedora
release (e.g. f29):
```
ModulemdTranslationHelpers --branch f29 extract [--pot-file <path>]
```
This will read all of the module metadata from the Koji build-system and
convert the translatable strings to a portable object template (`.pot`)
document.
Specify the destination for the output file with `--pot-file`.
### Produce modulemd-translations YAML
To convert portable object (`.po`) files into
modulemd-translations YAML documents that can be included in repodata:
```
ModulemdTranslationHelpers --branch f29 generate_metadata \
[--pofile-dir <path>] \
[--yaml-file <path>]
```
This will read all files with a `.po` suffix in the `pofile-dir` path and
write the modulemd YAML to `yaml-file`.
## API
### ModulemdTranslationHelpers
The ModulemdTranslationHelpers package has two primary functions:
* get_module_catalog_from_tags()
* get_modulemd_translations()
#### ModulemdTranslationHelpers.get_module_catalog_from_tags()
This returns a `babel.message.Catalog` object containing all of the
translatable strings from any module tagged with one of the passed tags. It
can be passed to `babel.messages.pofile.write_po()` to create a portable
object template (`.pot`) file.
#### ModulemdTranslationHelpers.get_modulemd_translations()
This returns an iterable of modulemd-translation objects generated from a
set of paths to portable object (`.po`) files containing translation
information.
### ModulemdTranslationHelpers.Fedora
This package provides helper routines for dealing with translations in Fedora
Modules.
#### ModulemdTranslationHelpers.Fedora.KOJI_URL
The URL to the standard Fedora Koji instance.
#### ModulemdTranslationHelpers.Fedora.get_fedora_rawhide_version()
Looks up which Fedora version the current Rawhide branch will become.
#### ModulemdTranslationHelpers.Fedora.get_tags_for_fedora_branch()
Gets the list of tags for modules in a given Fedora branch. (For rawhide,
make sure to use the value returned from get_fedora_rawhide_version.)
## Prerequisites
* [libmodulemd](https://github.com/fedora-modularity/libmodulemd)
* [koji](https://pagure.io/koji)
To install on Fedora 28+, run:
```
dnf install libmodulemd koji
```
## Installation
With the prerequisites installed, the latest version can be installed with
`pip install ModulemdTranslationHelpers` or on Fedora 28+ with `dnf install
python3-ModulemdTranslationHelpers` (recommended).
## CLI Usage
### Extract Translatable Strings
To extract translatable strings from modules for a particular Fedora
release (e.g. f29):
```
ModulemdTranslationHelpers --branch f29 extract [--pot-file <path>]
```
This will read all of the module metadata from the Koji build-system and
convert the translatable strings to a portable object template (`.pot`)
document.
Specify the destination for the output file with `--pot-file`.
### Produce modulemd-translations YAML
To convert portable object (`.po`) files into
modulemd-translations YAML documents that can be included in repodata:
```
ModulemdTranslationHelpers --branch f29 generate_metadata \
[--pofile-dir <path>] \
[--yaml-file <path>]
```
This will read all files with a `.po` suffix in the `pofile-dir` path and
write the modulemd YAML to `yaml-file`.
## API
### ModulemdTranslationHelpers
The ModulemdTranslationHelpers package has two primary functions:
* get_module_catalog_from_tags()
* get_modulemd_translations()
#### ModulemdTranslationHelpers.get_module_catalog_from_tags()
This returns a `babel.message.Catalog` object containing all of the
translatable strings from any module tagged with one of the passed tags. It
can be passed to `babel.messages.pofile.write_po()` to create a portable
object template (`.pot`) file.
#### ModulemdTranslationHelpers.get_modulemd_translations()
This returns an iterable of modulemd-translation objects generated from a
set of paths to portable object (`.po`) files containing translation
information.
### ModulemdTranslationHelpers.Fedora
This package provides helper routines for dealing with translations in Fedora
Modules.
#### ModulemdTranslationHelpers.Fedora.KOJI_URL
The URL to the standard Fedora Koji instance.
#### ModulemdTranslationHelpers.Fedora.get_fedora_rawhide_version()
Looks up which Fedora version the current Rawhide branch will become.
#### ModulemdTranslationHelpers.Fedora.get_tags_for_fedora_branch()
Gets the list of tags for modules in a given Fedora branch. (For rawhide,
make sure to use the value returned from get_fedora_rawhide_version.)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ModulemdTranslationHelpers-0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1491b46a431ec2a62be127b2317f721f884c151d9ca360efb74ec3b5ce385c31 |
|
MD5 | ae972a1748fc661301fb940516615d69 |
|
BLAKE2b-256 | a610a226eb4690aa4b235af57eacc6413124dbe76034a0176561a39438b05eb2 |
Close
Hashes for ModulemdTranslationHelpers-0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e4e0fb1aa74cc131d71ed29e4b50dc199519621a9b96c6fce5c120218dc1b61 |
|
MD5 | e769067aa8733e47c9d324d9b8b6314c |
|
BLAKE2b-256 | c5cdd74803c97f6ccb85c0e9d2334dba935fd005e0f72ba9cc89c4c468b42d48 |