Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1] Language of Parts [a11y] #2126

Closed
jgerman-bot opened this issue Nov 21, 2021 · 0 comments · Fixed by #2174
Closed

[4.1] Language of Parts [a11y] #2126

jgerman-bot opened this issue Nov 21, 2021 · 0 comments · Fixed by #2174

Comments

@jgerman-bot
Copy link

New language relevant PR in upstream repo: joomla/joomla-cms#35607 Here are the upstream changes:

Click to expand the diff!
diff --git a/administrator/language/en-GB/plg_editors_tinymce.ini b/administrator/language/en-GB/plg_editors_tinymce.ini
index 5eaba7a58db2..77fbe5aaa190 100644
--- a/administrator/language/en-GB/plg_editors_tinymce.ini
+++ b/administrator/language/en-GB/plg_editors_tinymce.ini
@@ -17,16 +17,20 @@ PLG_TINY_ERR_EDITORCSSFILENOTPRESENT="Could not find the file 'editor.css' in th
 PLG_TINY_ERR_UNSUPPORTEDBROWSER="Drag and drop image upload is not available for your browser. Please consider using a fully HTML5 compatible browser."
 PLG_TINY_FIELD_ADVIMAGE_LABEL="Advanced Image"
 PLG_TINY_FIELD_ADVLIST_LABEL="Advanced List"
+PLG_TINY_FIELD_CONTENTCODE_LABEL="Language Code"
+PLG_TINY_FIELD_CONTENTLANGS_DESC="Language of parts allows you to mark a word or phrase as a different language. To create the list of languages you need to enter a language name and a language code. This code can be just for the language eg: de or can include the region eg de-AT."
+PLG_TINY_FIELD_CONTENTLANGS_LABEL="Language of Parts"
+PLG_TINY_FIELD_CONTENTLANGUAGE_LABEL="Language Name"
 PLG_TINY_FIELD_CONTEXTMENU_LABEL="Context Menu"
 PLG_TINY_FIELD_CSS_DESC="By default the Plugin looks for an editor.css file. If it can't find one in the default template CSS folder, it loads the editor.css file from the system template."
 PLG_TINY_FIELD_CSS_LABEL="Template CSS Classes"
+PLG_TINY_FIELD_CUSTOMBUTTON_LABEL="Custom Button"
+PLG_TINY_FIELD_CUSTOMPLUGIN_LABEL="Custom Plugin"
 PLG_TINY_FIELD_CUSTOM_CONTENT_TEMPLATE_PATH_DESC="A directory named \"tinymce\" in your site template."
 PLG_TINY_FIELD_CUSTOM_CONTENT_TEMPLATE_PATH_LABEL="Content Template Directory"
 PLG_TINY_FIELD_CUSTOM_CSS_DESC="Optional CSS file that will override the standard editor.css file. Enter a file name to point to a file in the CSS folder of the default template (for example, templates/cassiopeia/css/). Or enter a full URL path to the custom CSS file. If you enter a value in this field, this file will be used instead of the editor.css file."
 PLG_TINY_FIELD_CUSTOM_CSS_LABEL="Custom CSS Classes"
 PLG_TINY_FIELD_CUSTOM_PATH_LABEL="Images Directory"
-PLG_TINY_FIELD_CUSTOMBUTTON_LABEL="Custom Button"
-PLG_TINY_FIELD_CUSTOMPLUGIN_LABEL="Custom Plugin"
 PLG_TINY_FIELD_DIRECTION_LABEL="Text Direction"
 PLG_TINY_FIELD_DRAG_DROP_LABEL="Images Drag and Drop"
 PLG_TINY_FIELD_ELEMENTS_LABEL="Extended Valid Elements"
diff --git a/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js b/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js
index 1c36d1b2e5d0..847bcd89b900 100644
--- a/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js
+++ b/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js
@@ -75,6 +75,7 @@ const tinymce = {
     'insert-time': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M19 2H5a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3zm-7 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16z"/><path d="M15 12h-3V7a.5.5 0 0 0-1 0v6h4a.5.5 0 0 0 0-1z"/></g></svg>',
     invert: '<svg width="24" height="24"><path d="M18 19.3L16.5 18a5.8 5.8 0 0 1-3.1 1.9 6.1 6.1 0 0 1-5.5-1.6A5.8 5.8 0 0 1 6 14v-.3l.1-1.2A13.9 13.9 0 0 1 7.7 9l-3-3 .7-.8 2.8 2.9 9 8.9 1.5 1.6-.7.6zm0-5.5v.3l-.1 1.1-.4 1-1.2-1.2a4.3 4.3 0 0 0 .2-1v-.2c0-.4 0-.8-.2-1.3l-.5-1.4a14.8 14.8 0 0 0-3-4.2L12 6a26.1 26.1 0 0 0-2.2 2.5l-1-1a20.9 20.9 0 0 1 2.9-3.3L12 4l1 .8a22.2 22.2 0 0 1 4 5.4c.6 1.2 1 2.4 1 3.6z" fill-rule="evenodd"/></svg>',
     italic: '<svg width="24" height="24"><path d="M16.7 4.7l-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8z" fill-rule="evenodd"/></svg>',
+    language: '<svg width="24" height="24"><path d="M12 3a9 9 0 110 18 9 9 0 010-18zm4.3 13.3c-.5 1-1.2 2-2 2.9a7.5 7.5 0 003.2-2.1l-.2-.2a6 6 0 00-1-.6zm-8.6 0c-.5.2-.9.5-1.2.8.9 1 2 1.7 3.2 2a10 10 0 01-2-2.8zm3.6-.8c-.8 0-1.6.1-2.2.3.5 1 1.2 1.9 2.1 2.7zm1.5 0v3c.9-.8 1.6-1.7 2.1-2.7-.6-.2-1.4-.3-2.1-.3zm-6-2.7H4.5c.2 1 .5 2.1 1 3h.3l1.3-1a10 10 0 01-.3-2zm12.7 0h-2.3c0 .7-.1 1.4-.3 2l1.6 1.1c.5-1 .9-2 1-3.1zm-3.8 0h-3V14c1 0 2 .1 2.7.4.2-.5.3-1 .3-1.6zm-4.4 0h-3l.3 1.6c.8-.3 1.7-.4 2.7-.4v-1.3zm-5.5-5c-.7 1-1.1 2.2-1.3 3.5h2.3c0-1 .2-1.8.5-2.6l-1.5-1zm2.9 1.4v.1c-.2.6-.4 1.3-.4 2h3V9.4c-1 0-1.8-.1-2.6-.3zm6.6 0h-.1l-2.4.3v1.8h3l-.5-2.1zm3-1.4l-.3.1-1.3.8c.3.8.5 1.6.5 2.6h2.3a7.5 7.5 0 00-1.3-3.5zm-9 0l2 .2V5.5a9 9 0 00-2 2.2zm3.5-2.3V8c.6 0 1.3 0 1.9-.2a9 9 0 00-2-2.3zm-3-.7h-.1c-1.1.4-2.1 1-3 1.8l1.2.7a10 10 0 011.9-2.5zm4.4 0l.1.1a10 10 0 011.8 2.4l1.1-.7a7.5 7.5 0 00-3-1.8z"/></svg>',
     line: '<svg width="24" height="24"><path d="M15 9l-8 8H4v-3l8-8 3 3zm1-1l-3-3 1-1h1c-.2 0 0 0 0 0l2 2s0 .2 0 0v1l-1 1zM4 18h16v2H4v-2z" fill-rule="evenodd"/></svg>',
     lineheight: '<svg width="24" height="24"><path d="M21 5a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zM7 3.6l3.7 3.7a1 1 0 01-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 011.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 011.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 01-1.3 0h-.1a1 1 0 010-1.3v-.1L7 3.6z"/></svg>',
     link: '<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2.1 2a2 2 0 1 0 2.7 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2zm11.6-.6a1 1 0 0 1-1.4-1.4l2-2a2 2 0 1 0-2.6-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2z" fill-rule="nonzero"/></svg>',
diff --git a/plugins/editors/tinymce/forms/setoptions.xml b/plugins/editors/tinymce/forms/setoptions.xml
index 272310df2413..3500ce021834 100644
--- a/plugins/editors/tinymce/forms/setoptions.xml
+++ b/plugins/editors/tinymce/forms/setoptions.xml
@@ -298,6 +298,35 @@
 			<option value="1">JON</option>
 		</field>
 
+		<field
+			name="content_languages"
+			type="subform"
+			label="PLG_TINY_FIELD_CONTENTLANGS_LABEL"
+			description="PLG_TINY_FIELD_CONTENTLANGS_DESC"
+			layout="joomla.form.field.subform.repeatable-table"
+			icon="list"
+			multiple="true"
+			default=''
+		>
+			<form hidden="true" name="content_languages" repeat="true">
+				<field
+					name="content_language_name"
+					type="text"
+					label="PLG_TINY_FIELD_CONTENTLANGUAGE_LABEL"
+					size="30"
+					filter="string"
+				/>
+
+				<field
+					name="content_language_code"
+					type="text"
+					label="PLG_TINY_FIELD_CONTENTCODE_LABEL"
+					size="10"
+					filter="string"
+				/>
+			</form>
+		</field>
+
 		<field
 			name="custom_plugin"
 			type="text"
diff --git a/plugins/editors/tinymce/tinymce.php b/plugins/editors/tinymce/tinymce.php
index bc0cbbd0623f..c78d885d3eaf 100644
--- a/plugins/editors/tinymce/tinymce.php
+++ b/plugins/editors/tinymce/tinymce.php
@@ -552,6 +552,20 @@ public function onDisplay(
 		// Convert pt to px in dropdown
 		$scriptOptions['fontsize_formats'] = '8px 10px 12px 14px 18px 24px 36px';
 
+		// select the languages for the "language of parts" menu
+		if (isset($extraOptions->content_languages) && $extraOptions->content_languages)
+		{
+			foreach (json_decode(json_encode($extraOptions->content_languages), true) as $content_language)
+			{
+				// if we have a language name and a language code then add to the menu
+				if ($content_language['content_language_name'] != '' && $content_language['content_language_code'] != '')
+				{
+					$ctemp[] = array('title' => $content_language['content_language_name'], 'code' => $content_language['content_language_code']);
+				}
+			}
+			$scriptOptions['content_langs'] = array_merge($ctemp);
+		}
+
 		// User custom plugins and buttons
 		$custom_plugin = trim($levelParams->get('custom_plugin', ''));
 		$custom_button = trim($levelParams->get('custom_button', ''));
@@ -998,6 +1012,8 @@ public static function getKnownButtons()
 			'pastetext'     => array('label' => 'Paste as text', 'plugin' => 'paste'),
 			'removeformat'  => array('label' => 'Clear formatting'),
 
+			'language'      => array('label' => 'Language'),
+
 			// Buttons from the plugins
 			'anchor'         => array('label' => 'Anchor', 'plugin' => 'anchor'),
 			'hr'             => array('label' => 'Horizontal line', 'plugin' => 'hr'),
@@ -1088,6 +1104,7 @@ public static function getToolbarPreset()
 				'cut', 'copy', 'paste', 'pastetext', '|',
 				'visualchars', 'visualblocks', 'nonbreaking', 'blockquote', 'template', '|',
 				'print', 'preview', 'codesample', 'insertdatetime', 'removeformat', 'jxtdbuttons',
+				'language',
 			),
 			'toolbar2' => array(),
 		);
diff --git a/templates/cassiopeia/scss/editor.scss b/templates/cassiopeia/scss/editor.scss
index 64b3cd71aea8..fdc549a87ee5 100644
--- a/templates/cassiopeia/scss/editor.scss
+++ b/templates/cassiopeia/scss/editor.scss
@@ -60,3 +60,13 @@ hr#system-readmore {
   border: #f00 dashed 1px;
 }
 
+span[lang] {
+  padding: 2px;
+  border: 1px dashed #bbb;
+  &:after {
+    font-size: smaller;
+    color: #f00;
+    vertical-align: super;
+    content: attr(lang);
+  }
+}
diff --git a/templates/system/scss/editor.scss b/templates/system/scss/editor.scss
index 4a54973fec2c..3a78d1528324 100644
--- a/templates/system/scss/editor.scss
+++ b/templates/system/scss/editor.scss
@@ -63,3 +63,14 @@ hr.system-pagebreak {
   color: #808080;
   border: #808080 dashed 1px;
 }
+
+span[lang] {
+  padding: 2px;
+  border: 1px dashed #bbb;
+  &:after {
+    font-size: smaller;
+    color: #f00;
+    vertical-align: super;
+    content: attr(lang);
+  }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants