? a11y ? NPM Resource Changed ? Success

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
6 Oct 2020

This is a plugin for TinyMCE 5 that allows users to specify what language their text is written in. As TinyMCE does not currently provide a plugin for language of parts this is an implementation of https://github.com/edx/tinymce-language-selector/.

The plugin wraps the desired text in span tags with a lang attribute for the specified language. Unspecified text is assumed to be written in the page's language. This helps the resulting text comply with WCAG 2.0 3.1.2 Language of Parts: "The human language of each passage or phrase in the content can be programmatically determined..."

parts

The only valid comments are on the implementation of the plugin. Comments about the plugin itself should be addressed upstream at https://github.com/edx/tinymce-language-selector/

[ The need for this is based on the EU funded research project for improving the process of creating accessible content by authors https://accessibilitycluster.com/about ]

If you have customised your tinymce editor toolbar you will need to edit the toolbar again to include this one

Testing

Dont forget to do a full npm ci

Todo - Help Wanted

In the build scripts

  1. Remove the empty folder media\vendor\tinymce-language-selector\
  2. To be compliant with the license node_modules@edx\tinymce-language-selector\LICENSE needs to be copied to the final folder
    Thank to @dgrammatiko for the work so far on those scripts
80a1615 6 Oct 2020 avatar brianteeman oops
avatar brianteeman brianteeman - open - 6 Oct 2020
avatar brianteeman brianteeman - change - 6 Oct 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Oct 2020
Category JavaScript Repository NPM Change Front End Plugins
avatar brianteeman
brianteeman - comment - 6 Oct 2020

Any help on that part @dgrammatiko will be greatly appreciated

avatar dgrammatiko
dgrammatiko - comment - 6 Oct 2020

Any help on that part @dgrammatiko will be greatly appreciated

I'm working on it. Unfortunately the build tools are not in great shape...

avatar brianteeman
brianteeman - comment - 6 Oct 2020

ah - ok. I did spend a few hours trying but that was more a trial by error than actually knowing what I was doing

avatar dgrammatiko
dgrammatiko - comment - 6 Oct 2020

@brianteeman check brianteeman#116

I will have to redo the JS part of the build tools but that should be ok for this PR

avatar brianteeman
brianteeman - comment - 6 Oct 2020

Thank @dgrammatiko reviewing it and will work on the pr in the morning. really appreciate the assistance

ec46f70 7 Oct 2020 avatar brianteeman wip
avatar brianteeman brianteeman - change - 7 Oct 2020
Labels Added: NPM Resource Changed ?
6dba150 7 Oct 2020 avatar brianteeman cs
avatar brianteeman
brianteeman - comment - 7 Oct 2020

@dgrammatiko almost but not quite. The following needs to happen

1. Remove export { BROWSER_DEFAULT, languages }; from the final plgin.js
2. Remove the empty folder media\vendor\tinymce-language-selector\
3. To be compliant with the license node_modules\@edx\tinymce-language-selector\LICENSE needs to be copied to the final folder

I really did try and work out how to do all of this and I learnt a lot but not enough to resolve this

avatar brianteeman brianteeman - change - 12 Oct 2020
The description was changed
avatar brianteeman brianteeman - edited - 12 Oct 2020
avatar brianteeman brianteeman - change - 12 Oct 2020
The description was changed
avatar brianteeman brianteeman - edited - 12 Oct 2020
avatar brianteeman brianteeman - change - 12 Oct 2020
Title
[4.0] language of parts
[4.0] language of parts [a11y]
avatar brianteeman brianteeman - edited - 12 Oct 2020
avatar brianteeman brianteeman - change - 12 Oct 2020
The description was changed
avatar brianteeman brianteeman - edited - 12 Oct 2020
avatar adj9
adj9 - comment - 20 Oct 2020

I tried PR with a complete installation of Joomla! and the choice of languages in TinyMCE is not yet present.

avatar brianteeman
brianteeman - comment - 20 Oct 2020

@adj9 please check in the plugin that its enabled for the toolbar you are using

avatar adj9
adj9 - comment - 20 Oct 2020

@brianteeman
You can tell me the name of the created plugin. In "Edit - TinyMCE" everything is enabled except "Use Joomla Text Filter". Thanks

avatar carcam
carcam - comment - 20 Oct 2020

@brianteeman I tried to test this on Saturday and I also couldn't. The tiny plugin is not being correctly moved on npm ci (although in the log you can see some action is taken)

I thought it was still a WiP and that's why I didn't comment earlier but reading your reply I guess this should work.

Maybe @dgrammatiko can provide some hint on what might be happening?

219f293 20 Oct 2020 avatar brianteeman regex
avatar brianteeman
brianteeman - comment - 20 Oct 2020

I have retested and found a few errors. Please retest by running npm ci

At this point you should have folders as in the screenshots below

node_modules/

image

media/

image

Check the plugin

image

Check Set 0 and click use advanced preset

image

Check editor in article

image

avatar carcam
carcam - comment - 21 Oct 2020

@brianteeman thank you very much for this clear explanation!! I can see the node_modules folder (I could also on Saturday) .

Now I can also see the folder in "media/plg_editors_tinymce/js/plugins/tinymce-language-selector" which I was not able to see on Saturday (I was not looking deeper enought in the tree I guess)

folder listing of the tinymce-language-selector folder in Joomla

But the "Language" button does not appear in the plugin editor:

Captura de pantalla 2020-10-21 a las 5 38 18

What am I missing? After npm ci should I do anything else?

Thank you very much!!

avatar infograf768
infograf768 - comment - 21 Oct 2020

It's working as intended here.

Two drawbacks:

  1. no possibility to parameter the plugin (display)
  2. no possibility to add languages Joomla proposes (prs, ckb, sy, srp, maybe others)

Concerning 1. It would be great to be able to choose the display between English (name) and language nativeName in the js in order to get if desired:

Screen Shot 2020-10-21 at 09 33 55

I modified the es6.js but it is always retrieved from https://registry.npmjs.org/@edx/tinymce-language-selector/-/tinymce-language-selector-1.1.0.tgz and evidently changes are lost when running npm ci.

One question: what does displaying a span with the lang tag gives as benefit to a11y? Would a screenreader finding the fa span be useful to tell the user that part is in Persian even if, by luck, it can read the content with a Persian accent?

avatar infograf768
infograf768 - comment - 21 Oct 2020

@carcam
Your test site is not current as the tabs have been corrected.
But nevertheless, your screenshot displays the existing toolbar for Set0

Look above the tabs. There you will find the Language button.
Drag and drop that button to the sets to use it.
Screen Shot 2020-10-21 at 10 14 14

avatar brianteeman
brianteeman - comment - 21 Oct 2020

@carcam Did you click on the Use Advanced Preset?

@infograf768
See original post

The only valid comments are on the implementation of the plugin. Comments about the plugin itself should be addressed upstream at https://github.com/edx/tinymce-language-selector/

Re the usefulness of the plugin. The accent thing is just an example. It is a requirement of WCAG AA that the language can be programmatically determined. It is not for us to question the WCAG

avatar brianteeman brianteeman - change - 21 Oct 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-10-21 08:17:54
Closed_By brianteeman
avatar brianteeman brianteeman - close - 21 Oct 2020
avatar brianteeman brianteeman - change - 21 Oct 2020
Status Closed New
Closed_Date 2020-10-21 08:17:54
Closed_By brianteeman
avatar brianteeman brianteeman - change - 21 Oct 2020
Status New Pending
avatar brianteeman brianteeman - reopen - 21 Oct 2020
avatar dgrammatiko
dgrammatiko - comment - 21 Oct 2020

no possibility to add languages Joomla proposes (prs, ckb, sy, srp, maybe others)

That’s doable. If someone comes up with the field in the backend I can patch the js

avatar brianteeman
brianteeman - comment - 21 Oct 2020

@dgrammatiko better to contribute it upstream

avatar joomla-cms-bot joomla-cms-bot - change - 21 Oct 2020
Category JavaScript Repository NPM Change Front End Plugins Unit Tests Repository Administration com_admin SQL Postgresql MS SQL com_associations com_categories com_config
avatar dgrammatiko
dgrammatiko - comment - 21 Oct 2020

@dgrammatiko better to contribute it upstream

There a no monkey patching. The languages come as an import so all is needed is an override of their constants.js with our version

avatar brianteeman
brianteeman - comment - 21 Oct 2020

@dgrammatiko I understand but I stand by what I said

avatar infograf768
infograf768 - comment - 21 Oct 2020

Posted issue on github
edx/tinymce-language-selector#13

avatar carcam
carcam - comment - 21 Oct 2020

@carcam Did you click on the Use Advanced Preset?

I did. But maybe as @infograf768 suggested I need to fetch branch again... Weird as I think I did it on Saturday before testing.

Will try today again.

Thanks!!

avatar brianteeman
brianteeman - comment - 21 Oct 2020

@infograf768 are you sure they are valid language codes for the language attribute which uses BCP47 https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang

avatar infograf768
infograf768 - comment - 21 Oct 2020

Our 3 letters lang code are iso639-3 included I guess in BCP47 as all iso-639 except 639-5
Looks like Syriac (sy in Joomla) should be syr. Our mistake.
https://iso639-3.sil.org/

The language identifiers in ISO 639-3 were devised for use in a wide range of applications, especially in computer systems where there is potential need to support a large number of the languages that are known to have ever existed. Whereas ISO 639-1 and ISO 639-2 are intended to focus on the major languages of the world that are most frequently represented in the total body of the world's literature, ISO 639-3 attempts to provide as complete an enumeration of languages as possible, including living, extinct, ancient and constructed languages, whether major or minor. As a result, ISO 639-3 lists a very large number of lesser-known languages. Languages designed exclusively for machine use, such as computer-programming languages, and reconstructed languages are not included in this code. Constructed languages that have not come into general use beyond a generation are also excluded.
```
avatar dgrammatiko
dgrammatiko - comment - 21 Oct 2020

@dgrammatiko I understand but I stand by what I said

Well one way or another we need to override this file because at the very least the string for the default language needs to be translated: https://github.com/edx/tinymce-language-selector/blob/6fb0642786b96932b4a9c00d5831d3fc3dea19d0/tinymce-language-selector/constants.js#L5-L8

Again, this is not changing the functionality of their code, but allows Joomla to plug in it's own strings (or even the selected languages per admin's preferences)

avatar brianteeman
brianteeman - comment - 21 Oct 2020

One thing I guess we could do is NOT to use the constant.js file and replace that with our own containing translatable strings. However I have no idea how to do that within the build process so someone would need to come up with the code as a PR against my branch

avatar priyankaSahutekdi priyankaSahutekdi - test_item - 7 Nov 2020 - Tested unsuccessfully
avatar priyankaSahutekdi
priyankaSahutekdi - comment - 7 Nov 2020

I have tested this item ? unsuccessfully on a63db6d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30939.

avatar brianteeman
brianteeman - comment - 7 Nov 2020

@priyankaSahutekdi What was unsuccessful. It is great that you are testing but please explain what is wrong

avatar carcam
carcam - comment - 12 Nov 2020

@brianteeman I have tried again with a new box with latest code from 4.0-dev branch of today and when trying to apply the path I see these issues:

  1. It could not apply the patch because there was no file .eslintignore .

  2. Then I created an empty file with touch .eslintignore in my box and tried to apply the patch again with this error:
    Joomla\Filesystem\File::delete: Failed deleting inaccessible file default_system.php

This was a new Joomla 4 installation form github code so I'm not sure whether it's my fault at some point. Any ideas? Thanks!!

avatar brianteeman
brianteeman - comment - 12 Nov 2020

@carcam something went wrong when updating the branch. Looking into it

avatar brianteeman brianteeman - change - 12 Nov 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 12 Nov 2020
Category Repository Unit Tests Administration com_admin SQL Postgresql MS SQL com_associations com_categories com_config JavaScript Repository Front End Plugins
avatar brianteeman brianteeman - change - 12 Nov 2020
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 12 Nov 2020
Category Repository JavaScript Front End Plugins JavaScript Repository NPM Change Front End Plugins
avatar brianteeman
brianteeman - comment - 12 Nov 2020

@carcam hopefully I fixed git

avatar carcam
carcam - comment - 13 Nov 2020

@carcam hopefully I fixed git

The whole git? That's a bold statement!! ?

Ok, back to work. Thank you very much for fixing this!! Now the patch applied and the npm run build:js worked fine (npm ci was stuck due to installation folder missing). I was able to see the "language" button in the editor plugin configuration, but no matter which profile I choose, the editor is broken and does not load:

Captura de pantalla 2020-11-13 a las 6 10 40

This was a brand new install from latest code this morning...

avatar brianteeman
brianteeman - comment - 13 Nov 2020

Closing for now until I get a chance to fix it

avatar brianteeman brianteeman - close - 13 Nov 2020
avatar brianteeman brianteeman - change - 13 Nov 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-11-13 07:24:28
Closed_By brianteeman
Labels Added: NPM Resource Changed
avatar carcam
carcam - comment - 15 Nov 2020

Too bad!! I'm sorry I couldn't help to make it happen. I'm using this language parts right now in my posts and I think it's really helpful as a non-native English speaker ?

avatar brianteeman
brianteeman - comment - 15 Nov 2020

Working on it right now. Looks like I lost a change when I fixed git. have to go back through my notes

avatar brianteeman brianteeman - change - 15 Nov 2020
Status Closed New
Closed_Date 2020-11-13 07:24:28
Closed_By brianteeman
avatar brianteeman brianteeman - change - 15 Nov 2020
Status New Pending
avatar brianteeman brianteeman - reopen - 15 Nov 2020
avatar brianteeman
brianteeman - comment - 15 Nov 2020

I have just done a new install and didnt have a problem with the editor

734097b 15 Nov 2020 avatar brianteeman oops
27baa71 15 Nov 2020 avatar brianteeman wip
090c95d 15 Nov 2020 avatar brianteeman cs
ed46372 15 Nov 2020 avatar brianteeman regex
avatar carcam carcam - test_item - 15 Nov 2020 - Tested successfully
avatar carcam
carcam - comment - 15 Nov 2020

I have tested this item successfully on f20f48d

Finally!! Thank you very much @brianteeman for your patience!!

I have performed this tests:

  1. Added language feature to Set 0
  2. Edit an article in backend and trying several languages for several words on my texts
  3. Removing language feature from set 0 and checking that TinyEditor keeps working
  4. Trying to create an article in frontend with an Author Level user: Tiny does not break
  5. Added lanugage feature to Set 1 and trying to edit an article with an Author user in frontend and language feature appears correctly

Best!!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30939.
avatar maikolort maikolort - test_item - 15 Nov 2020 - Tested successfully
avatar maikolort
maikolort - comment - 15 Nov 2020

I have tested this item successfully on f20f48d

I have tested this item succesfully

Mi system information is:
PHP Versión 7.4.10
Web Server Apache/2.4.46
Joomla Version: Joomla! 4.0.0-beta6-dev
User Agent: Mozilla/5.0

Thank you.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30939.
avatar Quy Quy - change - 15 Nov 2020
Status Pending Ready to Commit
avatar Quy
Quy - comment - 15 Nov 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30939.

avatar brianteeman
brianteeman - comment - 15 Nov 2020

Please remove the rtc. There are several outstanding todo

avatar Quy Quy - change - 15 Nov 2020
Status Ready to Commit Pending
avatar wilsonge
wilsonge - comment - 3 Jan 2021

@brianteeman is the todos in the PR description still current? Or other things to be done?

avatar wilsonge
wilsonge - comment - 3 Jan 2021

OK I think this brianteeman#119 is what you were after. But let me know and can tweak further. I'm not an expert at these build scripts so ?‍♂️

avatar brianteeman
brianteeman - comment - 3 Jan 2021

Thanks @wilsonge I will check it shortly. However at this time I think this will need to be retargeted for 4.1

avatar wilsonge
wilsonge - comment - 3 Jan 2021

Agreed

avatar brianteeman brianteeman - change - 3 Jan 2021
Title
[4.0] language of parts [a11y]
[4.1] language of parts [a11y]
avatar brianteeman brianteeman - edited - 3 Jan 2021
avatar infograf768
infograf768 - comment - 4 Jan 2021

Some tests with the new code:
Still no reply from edx/tinymce-language-selector#13

That is: #30939 (comment)
I have'nt seen anything new in this patch to cope with it.

Also no reply here to #30939 (comment) concerning the translation of the term Browser Default in the dropdown as well as Current Language: in the pop-up.

const languages = {
  // not a language, used to represent absence of a language defaulting to browser language
  BROWSER_DEFAULT: {
    name: 'Browser default',
    nativeName: 'Browser default'
  },
editor.windowManager.open({
      title: 'Language plugin',
      body: {
        type: 'panel',
        items: [{
          type: 'htmlpanel',
          html: `<div>Current language: ${languages[currentLang].nativeName}</div>`
        }, {
          type: 'selectbox',
          name: 'language',
          label: 'Language',
          items: Object.keys(languages).map(lang => ({
            value: lang,
            text: languages[lang].nativeName
          }))
        }]
      },

No mention either of a necessary update to the tinyMCE lang js updates in
/build/media_source/vendor/tinymce/langs/ all js files for Browser default language and Language Plugin added by this patch.

For French it would need adding to fr.es5.js
"Browser default language": "Langue par d\u00e9faut du navigateur",
"Language Plugin": "Plugin de langue"

to get
Screen Shot 2021-01-04 at 11 02 03

Bug

If I have'nt done anything wrong:

When admin is French Language and selecting a lang other than "Browser Default" in the pop-up, I get :
Uncaught TypeError: button is undefined plugin.js:813:7

line is:

    if (!lang || lang === BROWSER_DEFAULT) {
      button.innerText = 'Browser default language';
    } else {
      button.innerText = languages[lang].nativeName; // Line 813
    }

The pop-up does not close although the span is added to the text, for example <span lang="af">Joomla</span>

I also sometimes get the error below.

When admin is in en-GB, and I forget to highlight a term, I get:

Failed to find and set button ID in TinyMceLanguageSelectorPlugin after 3 attempts. plugin.js:921:15

although, this time the language selected does appear in the editor's bar.

avatar brianteeman
brianteeman - comment - 4 Jan 2021

This is on hold until after 4.0. No point working on something with a 4.1 target at this time

avatar wilsonge
wilsonge - comment - 4 Jan 2021

Moved this to draft so it's clear

avatar infograf768
infograf768 - comment - 4 Jan 2021

Moved this to draft so it's clear

Good decision. My tests just demonstrated that there are much more TODOs than stated in the description.

avatar brianteeman brianteeman - change - 3 Feb 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-02-03 19:30:36
Closed_By brianteeman
Labels Added: ? ? ?
Removed: ?
avatar brianteeman brianteeman - close - 3 Feb 2021
avatar brianteeman
brianteeman - comment - 4 Feb 2021

this will be re-opened after 4.0 is released

avatar brianteeman brianteeman - change - 6 Sep 2021
Status Closed New
Closed_Date 2021-02-03 19:30:36
Closed_By brianteeman
Labels Added: ? a11y ? ?
Removed: ? ? ?
avatar brianteeman brianteeman - change - 6 Sep 2021
Status New Pending
avatar brianteeman brianteeman - reopen - 6 Sep 2021
avatar brianteeman
brianteeman - comment - 19 Sep 2021

This PR is now closed and will be created using new core tinymce functionality

avatar brianteeman brianteeman - change - 19 Sep 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-09-19 18:55:54
Closed_By brianteeman
avatar brianteeman brianteeman - close - 19 Sep 2021
avatar brianteeman
brianteeman - comment - 19 Sep 2021

Replaced with #35607

Add a Comment

Login with GitHub to post a comment