Skip to content

Commit

Permalink
Prepare for Moodle 4.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Apr 21, 2024
1 parent 1bfc3c0 commit e25a34a
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 198 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -95,14 +113,15 @@ 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
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- 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 }}
Expand All @@ -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() }}
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
2 changes: 1 addition & 1 deletion db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
'archetypes' => [
'editingteacher' => CAP_ALLOW,
],
]
],
];
54 changes: 0 additions & 54 deletions lang/de/tiny_multilang2.php

This file was deleted.

26 changes: 12 additions & 14 deletions lang/en/tiny_multilang2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -41,26 +43,22 @@
}
</pre>
";
$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.
<br>The full list is available from <small><a href=\'https://www.w3schools.com/tags/ref_language_codes.asp\'>
<u>https://www.w3schools.com/tags/ref_language_codes.asp</u></a></small>';
$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.';
55 changes: 0 additions & 55 deletions lang/es/tiny_multilang2.php

This file was deleted.

55 changes: 0 additions & 55 deletions lang/fr/tiny_multilang2.php

This file was deleted.

23 changes: 14 additions & 9 deletions tests/behat/tiny_langfallback.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 <span> 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"
5 changes: 3 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];

0 comments on commit e25a34a

Please sign in to comment.