Translate 'Link' string to handle link plugin in different languages

This commit is contained in:
Iacopo Spalletti 2014-08-07 23:04:32 +02:00
parent 4849794ac0
commit 3a93332053
2 changed files with 6 additions and 4 deletions

View File

@ -212,7 +212,7 @@ $(document).ready(function () {
// on ajax receivement from server, build <a> or <img> tag dependig in the plugin type
insertPlugin: function (data) {
var element, attrs = { id: 'plugin_obj_' + data.plugin_id };
if (data.plugin_type === 'Link') {
if (data.plugin_type === this.options.lang.link) {
element = new CKEDITOR.dom.element('a', this.editor.document);
$.extend(attrs, {
'href': '#',
@ -234,7 +234,8 @@ $(document).ready(function () {
},
setupDataProcessor: function () {
var link_pattern = /^Link\s-\s(.+)$/;
var link_name = this.options.lang.link;
var link_pattern = new RegExp("/^"+ link_name +"\s-\s(.+)$/");
this.editor.dataProcessor.dataFilter.addRules({
elements: {
@ -242,7 +243,7 @@ $(document).ready(function () {
img: function(element) {
var new_element, matches;
if (element.attributes.id && element.attributes.alt
&& element.attributes.alt === 'Link'
&& element.attributes.alt === link_name
&& element.attributes.id.indexOf('plugin_obj_') === 0) {
matches = link_pattern.exec(element.attributes.title);
new_element = new CKEDITOR.htmlParser.element('a', {

View File

@ -30,7 +30,8 @@ $(document).ready(function () {
'toolbar': '{% filter escapejs %}{% trans "CMS Plugins" %}{% endfilter %}',
'add': '{% filter escapejs %}{% trans "Add CMS Plugin" %}{% endfilter %}',
'edit': '{% filter escapejs %}{% trans "Edit CMS Plugin" %}{% endfilter %}',
'aria': '{% filter escapejs %}{% trans "CMS Plugins" %}{% endfilter %}'
'aria': '{% filter escapejs %}{% trans "CMS Plugins" %}{% endfilter %}',
'link': '{% filter escapejs %}{% trans "Link" %}{% endfilter %}'
},
'plugins': [
{% regroup installed_plugins by module as module_list %}