Skip to main content

OARepo tools

Project description

oarepo-tools

Installation

Add oarepo-tools to 'dev' dependencies section of your setup.cfg

Usage

make-translations

To have unified translations across your javascript (+react) and python sources, add the following configuration to your setup.cfg:

[oarepo.i18n]
# List of language codes for which translations should be managed
languages =
    cs
    en

# List of paths to scan for babel messages - python files and jinja templates are scanned
babel_source_paths =
    oarepo_oaipmh_harvester/oai_harvester
    oarepo_oaipmh_harvester/oai_run
    oarepo_oaipmh_harvester/oai_record
    oarepo_oaipmh_harvester/oai_batch
    oarepo_oaipmh_harvester/ui

# extra message catalogues - if you use oarepo-model-builder to generate models, add the generated
# translations directories here
babel_input_translations =
    oarepo_oaipmh_harvester/oai_harvester/translations
    oarepo_oaipmh_harvester/oai_run/translations
    oarepo_oaipmh_harvester/oai_record/translations
    oarepo_oaipmh_harvester/oai_batch/translations

# List of paths to scan for i18next messages - javascript and jsx files are scanned
i18next_source_paths =
    oarepo_oaipmh_harvester/ui/oai_harvester/theme/assets/semantic-ui/js
    oarepo_oaipmh_harvester/ui/oai_run/theme/assets/semantic-ui/js
    oarepo_oaipmh_harvester/ui/oai_batch/theme/assets/semantic-ui/js
    oarepo_oaipmh_harvester/ui/oai_record/theme/assets/semantic-ui/js

# List of extra i18next message catalogues that should be merged into
i18next_input_translations =
    ui/docs-app/docs_app/theme/assets/semantic-ui/translations/docs_app/messages

# this is the location where python translations are generated.
babel_output_translations =
    oarepo_oaipmh_harvester/translations

# this is the location where javascript translations are generated. Add this directory to webpack
# aliases
i18next_output_translations =
    oarepo_oaipmh_harvester/ui/theme/assets/semantic-ui/translations


[options.entry_points]
# Do not forget to add this directory to your package data and `invenio_i18n.translations` entry point
# - without the 'translations' suffix
invenio_i18n.translations =
    oarepo_oaipmh_harvester = oarepo_oaipmh_harvester

To extract translation keys from your sources, run make-translations inside your module. This will generate po files inside the babel_output_translations directory.

Open the generated po files, either with poedit or directly, and translate the messages.

Then run make-translations again. This will both compile the translations for python sources and generate the json files for javascript sources.

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

oarepo_tools-0.2.6.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

oarepo_tools-0.2.6-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file oarepo_tools-0.2.6.tar.gz.

File metadata

  • Download URL: oarepo_tools-0.2.6.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for oarepo_tools-0.2.6.tar.gz
Algorithm Hash digest
SHA256 c9509ab41bd53ece735e0cad329299830172cce2811248833ee0d7dfb7092cae
MD5 4f43e75d1bed283b338b2045c77e6fe5
BLAKE2b-256 3700419c258ac55404736100f06523fb027d961b9b0c40f9adf66a722f274718

See more details on using hashes here.

File details

Details for the file oarepo_tools-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: oarepo_tools-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for oarepo_tools-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 06ed82c6a50c5c1f16842b3e2b26da8167dabfa78ea46e44b285f9c507d819d1
MD5 36af449b87ea395c6e0f830d89efd88d
BLAKE2b-256 acd216788842fd369c96e8708d741f35b1e7fe0c1ea5879d38fdcd2e82f641d8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page