# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University.
# Copyright (C) 2023 Graz University of Technology.
#
# Invenio App RDM is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

# Translate python strings
# 1) Create message catalog:
#    $ python setup.py extract_messages
#    $ python setup.py init_catalog -l <lang>
#    $ python setup.py compile_catalog
# 2) Ensure project has been created on Transifex under the invenio-app-rdm
#    organisation.
# 3) Install the transifex-client
#    $ pip install transifex-client
# 4) Push source (.pot) and translations (.po) to Transifex
#    $ tx push -s -t
# 5) Pull translations for a single language from Transifex
#    $ tx pull -l <lang>
# 6) Pull translations for all languages from Transifex
#    $ tx pull -a

[main]
host = https://app.transifex.com

[o:inveniosoftware:p:invenio:r:invenio-app-rdm-messages]
file_filter = invenio_app_rdm/translations/<lang>/LC_MESSAGES/messages.po
source_file = invenio_app_rdm/translations/messages.pot
source_lang = en
type = PO

# Translate JavaScript strings
# 1) Navigate to the invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm folder
# 2) Install i18n dev dependencies
#    npm install
# 3) Add a new language
#    npm run init_catalog lang <lang>
# 4) Extract translation keys/values
#    $ npm run extract_messages
# 5) Update the ./messages/index.js file
#    import TRANSLATE_<lang> from './<lang>/translations.json'
#    export const translations = {
#      ...rest,
#      <lang>: { translation: TRANSLATE_<lang> }
#    }
# 6) Install the transifex-client
#    $ pip install transifex-client
# 7) Push source (.pot) and translations (.po) to Transifex
#    $ tx push -s -t
# 8) Pull translations for a single language from Transifex
#    $ tx pull -l <lang>
# 9) Pull translations for all languages from Transifex
#    $ tx pull -a
# 10) Compile .po files for all languages
#    $ npm run compile_catalog
# 11) Convert .po file for a single language
#    $ npm run compile_catalog lang <lang>

[o:inveniosoftware:p:invenio:r:invenio-app-rdm-messages-ui]
file_filter = invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/<lang>/messages.po
source_file = invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/translations.pot
source_lang = en
type = PO
