Skip to content

feat(translations): ExApps on Python support Transifex translations sync #13184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions developer_manual/basics/translations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ They differ a bit in terms of usage compared to php:
t('myapp', '{name} is available. Get {linkstart}more information{linkend}', {name: 'Nextcloud 16', linkstart: '<a href="...">', linkend: '</a>'});
n('myapp', 'Import %n calendar into {collection}', 'Import %n calendars into {collection}', selectionLength, {collection: 'Nextcloud'});


ExApps (Python)
---------------

For ExApps, Python is currently only supported for automated Transifex translations.

Alongside the usual ``l10n/*.json`` and ``l10n/*.js`` files, translation source files located in ``translationfiles/<lang>/*.po`` are also included in the Transifex sync.
These ``.po`` files can be compiled into ``.mo`` files, which are typically used by the ExApp backend for runtime translations.

For more details, see :ref:`ex_app_translations`.


Guidelines
----------

Expand Down
13 changes: 12 additions & 1 deletion developer_manual/exapp_development/tech_details/Translations.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _ex_app_translations:

Translations
============

Expand All @@ -19,9 +21,18 @@ For the front-end part, AppAPI will inject the current user's locale ``l10n/<lan
Back-end
********

For the back-end part of ExApp, which can be written in different programming languages, it is **up to the developer to decide** how to handle and translations files.
For the back-end part of ExApp, which can be written in different programming languages, it is **up to the developer to decide** how to handle translations files.
There is an example repository with translations: `UI example with translations <https://github.com/nextcloud/ui_example>`_.

There are two Python functions used by `translationtool <https://github.com/nextcloud/docker-ci/tree/master/translations/translationtool>`_ to extract translation string: ``_('singular string')`` and ``_n('singular string', 'plural string', count)``.


Transifex sync
--------------

For automated Transifex sync there are only ``.po`` files included.
You can then compile them to ``.mo`` files using `ui_example's <https://github.com/nextcloud/ui_example/tree/main/scripts/compile_po_to_mo.sh>`_ ``scripts/compile_po_to_mo.sh`` script.


Manual install
**************
Expand Down
Loading