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] #35607

Merged
merged 13 commits into from
Nov 21, 2021
8 changes: 6 additions & 2 deletions administrator/language/en-GB/plg_editors_tinymce.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions plugins/editors/tinymce/forms/setoptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 18 additions & 0 deletions plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,21 @@ 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
brianteeman marked this conversation as resolved.
Show resolved Hide resolved
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', ''));
Expand Down Expand Up @@ -984,6 +999,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'),
Expand Down Expand Up @@ -1074,6 +1091,7 @@ public static function getToolbarPreset()
'cut', 'copy', 'paste', 'pastetext', '|',
'visualchars', 'visualblocks', 'nonbreaking', 'blockquote', 'template', '|',
'print', 'preview', 'codesample', 'insertdatetime', 'removeformat', 'jxtdbuttons',
'language',
),
'toolbar2' => array(),
);
Expand Down
10 changes: 10 additions & 0 deletions templates/cassiopeia/scss/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
11 changes: 11 additions & 0 deletions templates/system/scss/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}