Skip to content

Commit

Permalink
I18n
Browse files Browse the repository at this point in the history
  • Loading branch information
xyulex committed Mar 17, 2016
1 parent a79529b commit ef13d7d
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 20 deletions.
Binary file modified languages/tinymce-annotate-ca_ES.mo
Binary file not shown.
20 changes: 19 additions & 1 deletion languages/tinymce-annotate-ca_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tinymce-annotate\n"
"POT-Creation-Date: 2016-03-16 12:53+0100\n"
"PO-Revision-Date: 2016-03-16 13:00+0100\n"
"PO-Revision-Date: 2016-03-17 09:33+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -21,3 +21,21 @@ msgstr "Selecciona el text per a crear l'annotació"

msgid "Please select the annotation you want to delete"
msgstr "Selecciona l'anotació per a esborrar-la"

msgid "Delete annotation"
msgstr "Esborra annotació"

msgid "Create annotation"
msgstr "Crea annotació"

msgid "Hide annotations"
msgstr "Oculta les annotacions"

msgid "Annotation settings"
msgstr "Paràmetres de l'annotació"

msgid "Annotation"
msgstr "Annotació"

msgid "Background color"
msgstr "Color de fons"
Binary file modified languages/tinymce-annotate-es_ES.mo
Binary file not shown.
20 changes: 19 additions & 1 deletion languages/tinymce-annotate-es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tinymce-annotate\n"
"POT-Creation-Date: 2016-03-16 12:53+0100\n"
"PO-Revision-Date: 2016-03-16 13:23+0100\n"
"PO-Revision-Date: 2016-03-17 09:34+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -21,3 +21,21 @@ msgstr "Selecciona el texto para crear la anotación"

msgid "Please select the annotation you want to delete"
msgstr "Selecciona la anotación que deseas eliminar"

msgid "Delete annotation"
msgstr "Borrar anotación"

msgid "Create annotation"
msgstr "Crear anotación"

msgid "Hide annotations"
msgstr "Ocultar anotaciones"

msgid "Annotation settings"
msgstr "Parámetros de anotación"

msgid "Annotation"
msgstr "Anotación"

msgid "Background color"
msgstr "Color de fondo"
18 changes: 9 additions & 9 deletions plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

// Create annotation
editor.addButton('tma_annotate', {
title: 'Create annotation',
title: TMA.tooltips.annotation_create,
image: url + '/img/annotation.png',
onclick: function() {
annotation = '';
Expand Down Expand Up @@ -74,16 +74,16 @@
selectedText = node.innerHTML;
}
editor.windowManager.open({
title: 'Annotation options',
title: TMA.tooltips.annotation_settings,
body: [{
type: 'textbox',
name: 'annotation',
label: 'Annotation',
label: TMA.settings.setting_annotation,
value: annotation
}, {
type: 'colorpicker',
name: 'annotationbg',
label: 'Background color',
label: TMA.settings.setting_background,
value: color
}],

Expand All @@ -97,20 +97,20 @@
editor.selection.setContent('<span class="annotation" data-author="' + TMA.author + '" data-annotation="' + dataAnnotation.replace(/"/g,'&quot;') + '" style="background-color:' + e.data.annotationbg + '">' + selectedText + '</span>');

} else {
editor.windowManager.alert(TMA.missing_fields);
editor.windowManager.alert(TMA.errors.missing_fields);
return false;
}
}
});
} else {
editor.windowManager.alert(TMA.missing_annotation, false);
editor.windowManager.alert(TMA.errors.missing_annotation, false);
}
}
});

// Delete annotation
editor.addButton('tma_annotatedelete', {
title: 'Delete annotation',
title: TMA.tooltips.annotation_delete,
image: url + '/img/annotation-delete.png',
onclick: function() {
var selectedText = editor.selection.getContent();
Expand All @@ -125,14 +125,14 @@
$(deletionNode).attr("style", "");
editor.dom.remove(replaceNode, deletionNode);
} else {
editor.windowManager.alert(TMA.missing_selected);
editor.windowManager.alert(TMA.errors.missing_selected);
}
}
});

// Hide all annotations
editor.addButton('tma_annotatehide', {
title: 'Hide all annotations',
title: TMA.tooltips.annotation_hide,
image: url + '/img/annotation-hide.png',
cmd: 'tma_cmd_hide',
onPostRender: tma_toggleHide
Expand Down
28 changes: 21 additions & 7 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,28 @@ function tma_annotate() {
load_plugin_textdomain('tinymce-annotate', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
$current_user = wp_get_current_user();
wp_register_script( 'tmajs', plugins_url('/plugin.js', __FILE__));
wp_localize_script( 'tmajs', 'TMA', array(
'id' => $current_user->ID,
'author' => $current_user->display_name,
'missing_fields' => __('Select the color and the annotation text', 'tinymce-annotate'),
'missing_annotation' => __('Please select some text for creating an annotation', 'tinymce-annotate'),
'missing_selected' => __('Please select the annotation you want to delete', 'tinymce-annotate')
)
wp_localize_script( 'tmajs', 'TMA',
array(
'id' => $current_user->ID,
'author' => $current_user->display_name,
'errors' => array(
'missing_fields' => __('Select the color and the annotation text', 'tinymce-annotate'),
'missing_annotation' => __('Please select some text for creating an annotation', 'tinymce-annotate'),
'missing_selected' => __('Please select the annotation you want to delete', 'tinymce-annotate')
),
'tooltips' => array(
'annotation_settings' => __('Annotation settings', 'tinymce-annotate'),
'annotation_create' => __('Create annotation', 'tinymce-annotate'),
'annotation_delete' => __('Delete annotation', 'tinymce-annotate'),
'annotation_hide' => __('Hide annotations', 'tinymce-annotate')
),
'settings' => array(
'setting_annotation' => __('Annotation', 'tinymce-annotate'),
'setting_background' => __('Background color', 'tinymce-annotate')
)
)
);

wp_enqueue_script( 'tmajs' );
}

Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ Make sure you have selected at least a character.

== Changelog ==
= 1.1 =
Release date: March 20, 2016.
Release date: March 21, 2016.

* Show annotation author.
* Select annotation without doing it with the mouse.
* Added I18n.
* Added I18n (English, Spanish and Catalan).

= 1.0 =
Release date: November 10, 2015.
Expand Down

0 comments on commit ef13d7d

Please sign in to comment.