From e25a34a923df786974a37d99a52aa5159fc4060e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Sun, 21 Apr 2024 17:38:40 +0200 Subject: [PATCH] Prepare for Moodle 4.4. --- .github/workflows/moodle-plugin-ci.yml | 26 +++++++++--- README.md | 3 +- classes/privacy/provider.php | 2 +- db/access.php | 2 +- lang/de/tiny_multilang2.php | 54 ------------------------- lang/en/tiny_multilang2.php | 26 ++++++------ lang/es/tiny_multilang2.php | 55 -------------------------- lang/fr/tiny_multilang2.php | 55 -------------------------- tests/behat/tiny_langfallback.feature | 23 ++++++----- version.php | 5 ++- 10 files changed, 53 insertions(+), 198 deletions(-) delete mode 100644 lang/de/tiny_multilang2.php delete mode 100644 lang/es/tiny_multilang2.php delete mode 100644 lang/fr/tiny_multilang2.php diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 4a31d3b..bcbcbb0 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -30,6 +30,24 @@ jobs: fail-fast: false matrix: include: + - php: '8.1' + moodle-branch: 'MOODLE_404_STABLE' + database: pgsql + - php: '8.2' + moodle-branch: 'MOODLE_404_STABLE' + database: pgsql + - php: '8.3' + moodle-branch: 'MOODLE_404_STABLE' + database: pgsql + - php: '8.1' + moodle-branch: 'MOODLE_404_STABLE' + database: mariadb + - php: '8.2' + moodle-branch: 'MOODLE_404_STABLE' + database: mariadb + - php: '8.3' + moodle-branch: 'MOODLE_404_STABLE' + database: mariadb - php: '8.0' moodle-branch: 'MOODLE_403_STABLE' database: pgsql @@ -95,7 +113,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 @@ -103,6 +121,7 @@ jobs: - name: Install moodle-plugin-ci run: | + moodle-plugin-ci add-plugin --branch master iarenaza/moodle-filter_multilang2 moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 env: DB: ${{ matrix.database }} @@ -112,11 +131,6 @@ jobs: if: ${{ always() }} run: moodle-plugin-ci phplint - - name: PHP Copy/Paste Detector - continue-on-error: true # This step will show errors but will not fail - if: ${{ always() }} - run: moodle-plugin-ci phpcpd - - name: PHP Mess Detector continue-on-error: true # This step will show errors but will not fail if: ${{ always() }} diff --git a/README.md b/README.md index b754c20..d22f124 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ TinyMCE multilanguage plugin ![Release](https://img.shields.io/badge/Release-1.1-blue.svg) [![Moodle Plugin CI](https://github.com/bfh/moodle-tiny_multilang2/workflows/Moodle%20Plugin%20CI/badge.svg?branch=main)](https://github.com/bfh/moodle-tiny_multilang2/actions?query=workflow%3A%22Moodle+Plugin+CI%22+branch%3Amain) -![Supported](https://img.shields.io/badge/Moodle-4.1+-orange.svg) +[![PHP Support](https://img.shields.io/badge/php-7.4--8.3-blue)](https://github.com/bfh/moodle-quiz_archive/actions) +[![Moodle Support](https://img.shields.io/badge/Moodle-4.1--4.4+-orange)](https://github.com/bfh/moodle-quiz_archive/actions) [![License GPL-3.0](https://img.shields.io/github/license/bfh/moodle-tiny_multilang2?color=lightgrey)](https://github.com/bfh/moodle-tiny_multilang2/blob/main/LICENSE) [![GitHub contributors](https://img.shields.io/github/contributors/bfh/moodle-tiny_multilang2)](https://github.com/bfh/moodle-tiny_multilang2/graphs/contributors) diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 9335c92..7c00275 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -41,7 +41,7 @@ class provider implements \core_privacy\local\metadata\null_provider { * * @return string */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/db/access.php b/db/access.php index d763108..8a45661 100644 --- a/db/access.php +++ b/db/access.php @@ -33,5 +33,5 @@ 'archetypes' => [ 'editingteacher' => CAP_ALLOW, ], - ] + ], ]; diff --git a/lang/de/tiny_multilang2.php b/lang/de/tiny_multilang2.php deleted file mode 100644 index 22d8159..0000000 --- a/lang/de/tiny_multilang2.php +++ /dev/null @@ -1,54 +0,0 @@ -. - -/** - * Strings for 'Multilang v2' plugin. - * - * @package tiny_multilang2 - * @copyright 2015 onwards Iñaki Arenaza & Mondragon Unibertsitatea - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -$string['highlightcss'] = 'CSS für Sprachtag'; -$string['highlightcss_desc'] = "CSS für die Marker um dem sprachabhängigen Inhalt anzuzeigen. - -Wenn Sie die Spache anzeigen möchten, die in einem sprachabhängigen Block verwendet wird, kann folgendes CSS benutzt werden (dieses Beispiel ist für Deutsch, Fraben sind eventuell nicht optimal gewählt): - -
-.multilang-begin:lang(de):before {
-    content: \"de\";
-    position: relative;
-    top: -0.5em;
-    font-weight: bold;
-    background-color: #e05e5e;
-    color: #ffffff;
-}
-
-"; -$string['highlight'] = 'Trennzeichen hervorheben'; -$string['highlight_desc'] = 'Die Trennzeichen für den sprachabhänigen Inhalt sollen hervorgehoben werden (z.B., {mlang XX} und {mlang}) im WYSIWYG Editor'; -$string['pluginname'] = 'Multi-Language Content (v2)'; -$string['requiremultilang2'] = 'Benötigt Multi-Language Content (v2) Filter'; -$string['requiremultilang2_desc'] = 'Wenn aktiviert, wird das Menü und der Button im Editor nur dann angezeigt, wenn der Multi-Language Content (v2) Filter aktiv ist.'; -$string['showalllangs'] = 'Zeige alle Sprachen'; -$string['showalllangs_desc'] = 'Wenn aktiviert, werden im Editor alle Sprachen angezeigt, die von Moodle unterstützt werden. Wenn nicht aktivert, werden nur die installierten und aktiven Sprachen angezeigt.'; -$string['privacy:metadata'] = 'Das Tiny Multi-Language Content (v2) Plugin speichert keine personenbezogenen Daten.'; - -/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */ -$string['multilang2:desc'] = 'Unterstützung zum Hinzufügen von sprachabhänigem Inhalt (der Multi-Language Content (v2) filter muß aktiviert sein)'; -$string['multilang2:language'] = 'Sprache'; -$string['multilang2:viewlanguagemenu'] = 'Anzeigen der Sprachen als Liste im TinyMCE editor'; -$string['multilang2:other'] = 'andere'; diff --git a/lang/en/tiny_multilang2.php b/lang/en/tiny_multilang2.php index 6e02b25..af2962e 100644 --- a/lang/en/tiny_multilang2.php +++ b/lang/en/tiny_multilang2.php @@ -22,6 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +$string['addlanguage'] = 'Add language manually'; +$string['addlanguage_desc'] = 'If you choose this option, you can manually add languages by entering the iso code of the language in the textbox below. Otherwise, you must install at least 2 languages in the Language Pack.'; $string['helplinktext'] = 'Multi-Language Content (v2)'; $string['highlight'] = 'Highlight delimiters'; $string['highlight_desc'] = 'Visually highlight the multi-language content delimiters (i.e., {mlang XX} and {mlang}) in the WYSIWYG editor'; @@ -41,26 +43,22 @@ } "; -$string['pluginname'] = 'Multi-Language Content (v2)'; -$string['privacy:metadata'] = 'The Tiny Multi-Language Content (v2) plugin does not store any personal data.'; -$string['addlanguage'] = 'Add language manually'; -$string['addlanguage_desc'] = 'If you choose this option, you can manually add languages by entering the iso code of the language in the textbox below. Otherwise, you must install at least 2 languages in the Language Pack.'; -$string['language_setting'] = 'Language button settings'; $string['language_options_desc'] = 'Select options for the Language button drop-down menu.
The full list is available from https://www.w3schools.com/tags/ref_language_codes.asp'; +$string['language_setting'] = 'Language button settings'; $string['languageoptions'] = 'Language'; +$string['multilang2:desc'] = 'Add multilingual tags for content.'; +$string['multilang2:langTagsInSelection'] = 'Selected text contains language tags. Please click on a tag to select it.'; +$string['multilang2:language'] = 'Language'; +$string['multilang2:multiBlockElements'] = 'Selected text spans multiple paragraphs/block elements. Please select one only.'; +$string['multilang2:other'] = 'Fallback'; +$string['multilang2:removetag'] = 'Remove language tag'; +$string['multilang2:viewlanguagemenu'] = 'View language dropdown menu in TinyMCE editor'; +$string['pluginname'] = 'Multi-Language Content (v2)'; +$string['privacy:metadata'] = 'The Tiny Multi-Language Content (v2) plugin does not store any personal data.'; $string['removealltags'] = 'Remove all lang tags'; $string['requiremultilang2'] = 'Require Multi-Language Content (v2) filter'; $string['requiremultilang2_desc'] = 'If enabled, the language drop down menu is visible only when the Multi-Language Content (v2) filter is enabled.'; $string['showalllangs'] = 'Show all languages'; $string['showalllangs_desc'] = 'If enabled, the language drop down menu will contain all the languages Moodle supports. If not, only the installed and enabled languages will be shown.'; - -/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */ -$string['multilang2:desc'] = 'Add multilingual tags for content.'; -$string['multilang2:language'] = 'Language'; -$string['multilang2:viewlanguagemenu'] = 'View language dropdown menu in TinyMCE editor'; -$string['multilang2:other'] = 'Fallback'; -$string['multilang2:removetag'] = 'Remove language tag'; -$string['multilang2:multiBlockElements'] = 'Selected text spans multiple paragraphs/block elements. Please select one only.'; -$string['multilang2:langTagsInSelection'] = 'Selected text contains language tags. Please click on a tag to select it.'; diff --git a/lang/es/tiny_multilang2.php b/lang/es/tiny_multilang2.php deleted file mode 100644 index 10b74bb..0000000 --- a/lang/es/tiny_multilang2.php +++ /dev/null @@ -1,55 +0,0 @@ -. - -/** - * Strings for 'Multilang v2' plugin. - * - * @package tiny_multilang2 - * @copyright 2015 onwards Iñaki Arenaza & Mondragon Unibertsitatea - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -$string['highlightcss'] = 'CSS para los delimitadores'; -$string['highlightcss_desc'] = "CSS usado para destacar los delimitadores del contenido multi-idioma. - -Si desea mostrar el idioma para los bloque multi-idioma, puede usar algo como lo siguiente (este ejemplo es para el idioma Euskera, seguramente los colores no son los mejores posibles): - -
-.multilang-begin:lang(eu):before {
-    content: \"eu\";
-    position: relative;
-    top: -0.5em;
-    font-weight: bold;
-    background-color: #e05e5e;
-    color: #ffffff;
-}
-
-"; -$string['highlight'] = 'Destacar los delimitadores'; -$string['highlight_desc'] = 'Destacar visualmente los delimitadores del contenido multi-idioma (esto es, {mlang XX} y {mlang}) en el editor WYSIWYG'; -$string['pluginname'] = 'Contenido Multi-Idioma (v2)'; -$string['requiremultilang2'] = 'Requerir el filtro de Contenido Multi-Idioma (v2)'; -$string['requiremultilang2_desc'] = 'Si se habilita, el menú desplegable de selección de idiomas solo es visible cuando esté habilitado el filtro de Contenido Multi-Idioma (v2).'; -$string['showalllangs'] = 'Mostrar todos los idiomas'; -$string['showalllangs_desc'] = 'Si se habilita, el menú desplegable de selección de idiomas contendrá todos los idiomas soportados por Moodle. En caso contrario, sólo se mostrarán los idiomas instalados y habilitados'; -$string['privacy:metadata'] = 'El plugin Tiny Contenido Multi-Idioma (v2) no guarda datos personales.'; - -/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */ -$string['multilang2:desc'] = 'Ayuda a añadir contenido multi-idioma (necesita tener habilitado el filtro de Contenido Multi-Idioma (v2))'; -$string['multilang2:language'] = 'Idioma'; -$string['multilang2:viewlanguagemenu'] = 'Ver el menú desplegable de idiomas en el editor TinyMCE'; -$string['multilang2:other'] = 'otro'; - diff --git a/lang/fr/tiny_multilang2.php b/lang/fr/tiny_multilang2.php deleted file mode 100644 index fdc0993..0000000 --- a/lang/fr/tiny_multilang2.php +++ /dev/null @@ -1,55 +0,0 @@ -. - -/** - * Strings for 'Multilang v2' plugin. - * - * @package tiny_multilang2 - * @copyright 2015 onwards Iñaki Arenaza & Mondragon Unibertsitatea - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -$string['highlightcss'] = 'CSS pour séparateurs'; -$string['highlightcss_desc'] = "CSS utilisé pour mettre en évidence les délimiteurs de contenus multilingues. - -Si vous souhaitez afficher la langue pour les blocs {mlang}, vous pouvez utiliser quelque chose comme ce qui suit (cet exemple s'applique à la langue Française) : - -
-.multilang-begin:lang(fr):before {
-    content: \"fr\";
-    position: relative;
-    top: -0.5em;
-    font-weight: bold;
-    background-color: #e05e5e;
-    color: #ffffff;
-}
-
-"; -$string['highlight'] = 'mettre en évidence les délimiteurs'; -$string['highlight_desc'] = "Mettre en évidence visuellement les délimiteurs multilingues (c.-à-d. {mlang XX} et {mlang}) dans l'éditeur WYSIWYG."; -$string['pluginname'] = 'Contenu multilingue (v2)'; -$string['requiremultilang2'] = 'Exige le filtre Contenu multilingue (v2)'; -$string['requiremultilang2_desc'] = 'Si activé, le menu déroulant des langues sera visible uniquement lorsque le filtre Contenu multilingue (v2) est activé.'; -$string['showalllangs'] = 'Afficher toutes les langues'; -$string['showalllangs_desc'] = 'Si activé, le menu déroulant des langues contiendra toutes les langues supporté dans Moodle. Si pas activé, seules les langues installées et activées apparaitront.'; -$string['privacy:metadata'] = 'Tiny Contenu multilingue (v2) ne stocke aucune donnée personnelle.'; - -/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */ -$string['multilang2:desc'] = 'Aide à ajouter du contenu multilingue (le filtre Contenu multilingue (v2) doit être activé)'; -$string['multilang2:language'] = 'Langue'; -$string['multilang2:viewlanguagemenu'] = 'Voir le menu déroulant des langues à l\'éditeur TinyMCE'; -$string['multilang2:other'] = 'autre'; - diff --git a/tests/behat/tiny_langfallback.feature b/tests/behat/tiny_langfallback.feature index 4bcb7f8..73cad05 100644 --- a/tests/behat/tiny_langfallback.feature +++ b/tests/behat/tiny_langfallback.feature @@ -11,6 +11,8 @@ Feature: Tiny editor multilang plugin for default behaviour with no multilangfil | de | And the "multilang" filter is "on" And the "multilang" filter applies to "content and headings" + And the "multilang2" filter is "on" + And the "multilang2" filter applies to "content and headings" And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | @@ -25,22 +27,25 @@ Feature: Tiny editor multilang plugin for default behaviour with no multilangfil Scenario: I login as admin and select the paragraphs and set the language to english and german When I am on "Course 1" course homepage - And I am on the "PageName1" "page activity" page + And I am on the "PageName1" "page activity editing" page logged in as admin And I navigate to "Settings" in current page administration - And I click on "//a[@id='collapseElement-0']" "xpath_element" + And I expand all fieldsets And I select the inner "p" element in position "0" of the "Page content" TinyMCE editor And I click on the "Format > Language > English (en)" submenu item for the "Page content" TinyMCE editor And I click on "//h1" "xpath_element" And I select the inner "p" element in position "1" of the "Page content" TinyMCE editor And I click on the "Format > Language > Deutsch (de)" submenu item for the "Page content" TinyMCE editor And I press "Save and display" - # Because the two texts are in different nodes, we are only able to check that the elements have been applied. - Then I should see "Some plain text" in the "//span[@lang='en'][1]" "xpath_element" - And I should see "Ein anderer Text" in the "//span[@lang='de'][1]" "xpath_element" - And I navigate to "Settings" in current page administration - And I click on "//a[@id='collapseElement-0']" "xpath_element" + Then I should see "Some plain text" + And I should not see "Ein anderer Text" + And I follow "Language" in the user menu + And I follow "Deutsch ‎(de)‎" + And I should see "Ein anderer Text" + And I should not see "Some plain text" + And I am on the "PageName1" "page activity editing" page logged in as admin + And I expand all fieldsets And I select the "span" element in position "2" of the "Page content" TinyMCE editor And I click on the "Format > Language > English (en)" submenu item for the "Page content" TinyMCE editor And I press "Save and display" - Then I should see "Some plain text" in the "//p[1]/span[@lang='en']" "xpath_element" - And I should see "Ein anderer Text" in the "//p[2]/span[@lang='en']" "xpath_element" + Then I should see "Some plain text" + And I should see "Ein anderer Text" diff --git a/version.php b/version.php index b7cb33d..eaad7d9 100644 --- a/version.php +++ b/version.php @@ -28,7 +28,8 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'tiny_multilang2'; -$plugin->release = '1.1'; -$plugin->version = 2023100900; +$plugin->release = '1.2'; +$plugin->version = 2024042200; $plugin->requires = 2022112800; $plugin->maturity = MATURITY_RC; +$plugin->supported = [401, 404];