User tests: Successful: Unsuccessful:
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..."
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
Dont forget to do a full npm ci
In the build scripts
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript Repository NPM Change Front End Plugins |
Any help on that part @dgrammatiko will be greatly appreciated
I'm working on it. Unfortunately the build tools are not in great shape...
ah - ok. I did spend a few hours trying but that was more a trial by error than actually knowing what I was doing
@brianteeman check brianteeman#116
I will have to redo the JS part of the build tools but that should be ok for this PR
Thank @dgrammatiko reviewing it and will work on the pr in the morning. really appreciate the assistance
Labels |
Added:
NPM Resource Changed
?
|
@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
Title |
|
I tried PR with a complete installation of Joomla! and the choice of languages in TinyMCE is not yet present.
@brianteeman
You can tell me the name of the created plugin. In "Edit - TinyMCE" everything is enabled except "Use Joomla Text Filter". Thanks
@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?
@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)
But the "Language" button does not appear in the plugin editor:
What am I missing? After npm ci should I do anything else?
Thank you very much!!
It's working as intended here.
Two drawbacks:
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:
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?
@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
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-10-21 08:17:54 |
Closed_By | ⇒ | brianteeman |
Status | Closed | ⇒ | New |
Closed_Date | 2020-10-21 08:17:54 | ⇒ | |
Closed_By | brianteeman | ⇒ |
Status | New | ⇒ | Pending |
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
@dgrammatiko better to contribute it upstream
Category | JavaScript Repository NPM Change Front End Plugins | ⇒ | Unit Tests Repository Administration com_admin SQL Postgresql MS SQL com_associations com_categories com_config |
@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
@dgrammatiko I understand but I stand by what I said
Posted issue on github
edx/tinymce-language-selector#13
@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!!
@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
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.
```
@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)
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
I have tested this item
@priyankaSahutekdi What was unsuccessful. It is great that you are testing but please explain what is wrong
@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:
It could not apply the patch because there was no file .eslintignore .
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!!
Labels |
Added:
?
|
Category | Repository Unit Tests Administration com_admin SQL Postgresql MS SQL com_associations com_categories com_config | ⇒ | JavaScript Repository Front End Plugins |
Labels |
Removed:
?
|
Category | Repository JavaScript Front End Plugins | ⇒ | JavaScript Repository NPM Change Front End Plugins |
@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:
This was a brand new install from latest code this morning...
Closing for now until I get a chance to fix it
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
|
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
Working on it right now. Looks like I lost a change when I fixed git. have to go back through my notes
Status | Closed | ⇒ | New |
Closed_Date | 2020-11-13 07:24:28 | ⇒ | |
Closed_By | brianteeman | ⇒ |
Status | New | ⇒ | Pending |
I have just done a new install and didnt have a problem with the editor
I have tested this item
Finally!! Thank you very much @brianteeman for your patience!!
I have performed this tests:
Best!!
I have tested this item
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.
Status | Pending | ⇒ | Ready to Commit |
RTC
Please remove the rtc. There are several outstanding todo
Status | Ready to Commit | ⇒ | Pending |
@brianteeman is the todos in the PR description still current? Or other things to be done?
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
Agreed
Title |
|
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"
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.
This is on hold until after 4.0. No point working on something with a 4.1 target at this time
Moved this to draft so it's clear
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.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-02-03 19:30:36 |
Closed_By | ⇒ | brianteeman | |
Labels |
Added:
?
?
?
Removed: ? |
this will be re-opened after 4.0 is released
Status | Closed | ⇒ | New |
Closed_Date | 2021-02-03 19:30:36 | ⇒ | |
Closed_By | brianteeman | ⇒ | |
Labels |
Added:
?
a11y
?
?
Removed: ? ? ? |
Status | New | ⇒ | Pending |
This PR is now closed and will be created using new core tinymce functionality
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-09-19 18:55:54 |
Closed_By | ⇒ | brianteeman |
Any help on that part @dgrammatiko will be greatly appreciated