# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 CERN.
#
# invenio-administration is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.

# TODO: Transifex integration
#
# 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 inveniosoftware
#    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://www.transifex.com

[invenio.invenio-administration-messages]
file_filter = invenio_administration/translations/<lang>/LC_MESSAGES/messages.po
source_file = invenio_administration/translations/messages.pot
source_lang = en
type = PO

# Translate JavaScript strings
# 1) Navigate to the invenio_administration/assets/semantic-ui/translations/invenio_administration 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>

[invenio.invenio-administration-messages-ui]
file_filter = invenio_administration/assets/semantic-ui/translations/invenio_administration/messages/<lang>/messages.po
source_file = invenio_administration/assets/semantic-ui/translations/invenio_administration/translations.pot
source_lang = en
type = PO

