From 6418a66e17086f40ea9eb173e81c8e2824273db7 Mon Sep 17 00:00:00 2001 From: Ricardo Aragon Date: Tue, 19 May 2026 11:55:50 +0200 Subject: [PATCH] chore: crowdin integration --- .github/workflows/crowdin.yml | 57 ++++++++++++++++++++++ crowdin.yml | 19 ++++++++ languages/pressbooks-shortcode-handler.pot | 40 +++++++++++++++ pressbooks-shortcode-handler.php | 4 ++ 4 files changed, 120 insertions(+) create mode 100644 .github/workflows/crowdin.yml create mode 100644 crowdin.yml create mode 100644 languages/pressbooks-shortcode-handler.pot diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml new file mode 100644 index 0000000..a80e8fd --- /dev/null +++ b/.github/workflows/crowdin.yml @@ -0,0 +1,57 @@ +name: Crowdin Translations Sync + +on: + push: + branches: + - dev + paths: + - 'languages/pressbooks-shortcode-handler.pot' + + schedule: + - cron: '0 0 * * *' + + workflow_dispatch: + inputs: + action: + description: 'Action to perform' + type: choice + options: + - Pull Translations + - Seed Translations + default: Pull Translations + +jobs: + upload-sources: + name: Upload Sources + if: github.event_name == 'push' + uses: pressbooks/reusable-workflows/.github/workflows/crowdin.yml@main + with: + action: upload + pot_file_path: languages/pressbooks-shortcode-handler.pot + crowdin_branch_name: pressbooks-shortcode-handler + base_branch: dev + secrets: inherit + + download-translations: + name: Pull Translations + if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.action == 'Pull Translations') + uses: pressbooks/reusable-workflows/.github/workflows/crowdin.yml@main + with: + action: download + pot_file_path: languages/pressbooks-shortcode-handler.pot + languages_dir: languages/ + crowdin_branch_name: pressbooks-shortcode-handler + base_branch: dev + secrets: inherit + + seed-translations: + name: Seed Translations + if: github.event_name == 'workflow_dispatch' && github.event.inputs.action == 'Seed Translations' + uses: pressbooks/reusable-workflows/.github/workflows/crowdin.yml@main + with: + action: seed + pot_file_path: languages/pressbooks-shortcode-handler.pot + languages_dir: languages/ + crowdin_branch_name: pressbooks-shortcode-handler + base_branch: dev + secrets: inherit \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 0000000..c256002 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,19 @@ +"project_id_env": "CROWDIN_OPEN_PROJECT_ID" +"api_token_env": "CROWDIN_API_SECRET" +"pull_request_title": "chore(l10n): update languages" +"preserve_hierarchy": true +"files": [ + { + "source": "/languages/pressbooks-shortcode-handler.pot", + "dest": "/languages/pressbooks-shortcode-handler.pot", + "translation": "/languages/pressbooks-shortcode-handler-%locale_with_underscore%.po", + "languages_mapping": { + "locale_with_underscore": { + "es-ES": "es_ES", + "es-MX": "es_MX", + "fr": "fr_FR", + "fr-CA": "fr_CA" + } + } + } +] \ No newline at end of file diff --git a/languages/pressbooks-shortcode-handler.pot b/languages/pressbooks-shortcode-handler.pot new file mode 100644 index 0000000..7bd5258 --- /dev/null +++ b/languages/pressbooks-shortcode-handler.pot @@ -0,0 +1,40 @@ +# Copyright (C) 2026 Pressbooks (Book Oven Inc.) +# This file is distributed under the GPL v3 or later. +msgid "" +msgstr "" +"Project-Id-Version: Pressbooks Shortcode Handler 1.2.0\n" +"Report-Msgid-Bugs-To: https://github.com/pressbooks/pressbooks-network-analytics/issues\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2026-05-19T09:52:12+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.13.0-alpha\n" +"X-Domain: pressbooks-shortcode-handler\n" + +#. Plugin Name of the plugin +#: pressbooks-shortcode-handler.php +msgid "Pressbooks Shortcode Handler" +msgstr "" + +#. Plugin URI of the plugin +#: pressbooks-shortcode-handler.php +msgid "https://github.com/pressbooks/pressbooks-shortcode-handler" +msgstr "" + +#. Description of the plugin +#: pressbooks-shortcode-handler.php +msgid "Plugin for Pressbooks to handle additional shortcodes used by Lumen Learning." +msgstr "" + +#. Author of the plugin +#: pressbooks-shortcode-handler.php +msgid "Pressbooks (Book Oven Inc.)" +msgstr "" + +#. Author URI of the plugin +#: pressbooks-shortcode-handler.php +msgid "https://pressbooks.org" +msgstr "" diff --git a/pressbooks-shortcode-handler.php b/pressbooks-shortcode-handler.php index 8049100..23bace8 100644 --- a/pressbooks-shortcode-handler.php +++ b/pressbooks-shortcode-handler.php @@ -23,6 +23,10 @@ add_shortcode( 'ohm2_question', 'ohmQuestionShortcodeHandler' ); add_shortcode( 'choosedataset', 'choosedatasetShortcodeHandler' ); +add_action( 'init', function() { + load_plugin_textdomain( 'pressbooks-shortcode-handler', false, 'pressbooks-shortcode-handler/languages' ); +} ); + /** * Shortcode handler for [reveal-answer]. * Ex: [reveal-answer q="153"]Show Answer[/reveal-answer].