|
2 | 2 | ## Prerequisites |
3 | 3 | * [libmodulemd](https://github.com/fedora-modularity/libmodulemd) |
4 | 4 | * [koji](https://pagure.io/koji) |
5 | | -* [zanata-client](https://github.com/zanata/zanata-client) |
6 | 5 |
|
7 | 6 | To install on Fedora 28+, run: |
8 | 7 | ``` |
9 | | -dnf install libmodulemd koji zanata-client |
| 8 | +dnf install libmodulemd koji |
10 | 9 | ``` |
11 | 10 |
|
12 | 11 | ## Installation |
13 | 12 | With the prerequisites installed, the latest version can be installed with |
14 | | -`pip install mmdzanata` or on Fedora 28+ with `dnf install mmdzanata` |
15 | | -(recommended). |
| 13 | +`pip install ModulemdTranslationHelpers` or on Fedora 28+ with `dnf install |
| 14 | +python3-ModulemdTranslationHelpers` (recommended). |
16 | 15 |
|
17 | 16 | ## CLI Usage |
18 | | -### Zanata Client Setup |
19 | | -Use of the upload feature for string extraction requires setting up the |
20 | | -Zanata client appropriately. Follow the |
21 | | -[instructions](http://docs.zanata.org/en/release/client/configuration/) from |
22 | | -Zanata to set up your `~/.config/zanata.ini` file appropriately. Note that |
23 | | -you will want to do this against |
24 | | -https://fedora.zanata.org |
25 | | -and not |
26 | | -https://translate.zanata.org |
27 | 17 |
|
28 | 18 | ### Extract Translatable Strings |
29 | 19 | To extract translatable strings from modules for a particular Fedora |
30 | 20 | release (e.g. f29): |
31 | 21 | ``` |
32 | | -mmdzanata --branch f29 extract [--upload] |
| 22 | +ModulemdTranslationHelpers --branch f29 extract [--pot-file <path>] |
33 | 23 | ``` |
34 | 24 | This will read all of the module metadata from the Koji build-system and |
35 | | -convert the translatable strings to a Zanata-compatible gettext document. If |
36 | | - `--upload` is passed, it will also attempt to use the `zanata-cli` tool to |
37 | | - upload the strings to the Zanata server. See the "Zanata Client Setup" |
38 | | - section above for information on how to configure this. |
| 25 | +convert the translatable strings to a Zanata-compatible gettext document. |
| 26 | +Specify the destination for the POT file with `--pot-file`. |
39 | 27 |
|
40 | 28 | ### Produce modulemd-translations YAML |
41 | 29 | To read the translated strings from Zanata and convert them into |
42 | 30 | modulemd-translations YAML documents that can be included in repodata: |
43 | 31 | ``` |
44 | | - mmdzanata --branch f29 generate_modulemd |
| 32 | + ModulemdTranslationHelpers --branch f29 generate_metadata \ |
| 33 | + [--pofile-dir <path>] \ |
| 34 | + [--yaml-file <path>] |
| 35 | +
|
45 | 36 | ``` |
46 | 37 |
|
47 | | - This will produce a YAML file in the current directory with all known |
48 | | - translated strings. |
| 38 | + This will read all files with a `.po` suffix in the `pofile-dir` path and |
| 39 | + write the modulemd YAML to `yaml-file`. |
49 | 40 |
|
50 | 41 | ## API |
51 | | -### mmdzanata |
52 | | -The mmdzanata class has two primary methods: |
| 42 | +### ModulemdTranslationHelpers |
| 43 | +The ModulemdTranslationHelpers package has two primary functions: |
53 | 44 | * get_module_catalog_from_tags() |
54 | | -* generate_metadata() |
| 45 | +* get_modulemd_translations() |
55 | 46 |
|
56 | | -#### mmdzanata.get_module_catalog_from_tags() |
57 | | -This returns a babel.message.Catalog object containing all of the |
58 | | -translatable strings from any module tagged with one of the passed tags. |
| 47 | +#### ModulemdTranslationHelpers.get_module_catalog_from_tags() |
| 48 | +This returns a `babel.message.Catalog` object containing all of the |
| 49 | +translatable strings from any module tagged with one of the passed tags. It |
| 50 | +can be passed to `babel.messages.pofile.write_po()` to create a portable |
| 51 | +object template (`.pot`) file. |
59 | 52 |
|
60 | | -#### mmmdzanata.generate_metadata() |
61 | | -This returns an iterable of modulemd-translation objects from the supplied |
62 | | -Zanata project and branch. |
| 53 | +#### ModulemdTranslationHelpers.get_modulemd_translations() |
| 54 | +This returns an iterable of modulemd-translation objects generated from a |
| 55 | +set of paths to portable object (`.po`) files containing translation |
| 56 | +information. |
63 | 57 |
|
64 | | -### mmdzanata.fedora |
65 | | -This class provides helper routines for dealing with translations in Fedora |
| 58 | +### ModulemdTranslationHelpers.Fedora |
| 59 | +This package provides helper routines for dealing with translations in Fedora |
66 | 60 | Modules. |
| 61 | + |
| 62 | +#### ModulemdTranslationHelpers.Fedora.KOJI_URL |
| 63 | +The URL to the standard Fedora Koji instance. |
| 64 | + |
| 65 | +#### ModulemdTranslationHelpers.Fedora.get_fedora_rawhide_version() |
| 66 | +Looks up which Fedora version the current Rawhide branch will become. |
| 67 | + |
| 68 | +#### ModulemdTranslationHelpers.Fedora.get_tags_for_fedora_branch() |
| 69 | +Gets the list of tags for modules in a given Fedora branch. (For rawhide, |
| 70 | +make sure to use the value returned from get_fedora_rawhide_version.) |
0 commit comments