aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/tinymce/activate.php14
-rw-r--r--mod/tinymce/languages/en.php3
-rw-r--r--mod/tinymce/start.php12
-rw-r--r--mod/tinymce/views/default/js/tinymce.php3
4 files changed, 30 insertions, 2 deletions
diff --git a/mod/tinymce/activate.php b/mod/tinymce/activate.php
new file mode 100644
index 000000000..953e3c25b
--- /dev/null
+++ b/mod/tinymce/activate.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Prompt the user to install a tinymce language after activating
+ */
+
+if (elgg_get_config('language') != tinymce_get_site_language()) {
+ $message = elgg_echo('tinymce:lang_notice', array(
+ elgg_echo(elgg_get_config('language')),
+ "http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download",
+ elgg_get_plugins_path() . "tinymce/vendor/tinymce/jscripts/tiny_mce",
+ elgg_add_action_tokens_to_url(elgg_normalize_url('action/admin/site/flush_cache')),
+ ));
+ elgg_add_admin_notice('tinymce_admin_notice_no_lang', $message);
+}
diff --git a/mod/tinymce/languages/en.php b/mod/tinymce/languages/en.php
index 811e93492..293e68b35 100644
--- a/mod/tinymce/languages/en.php
+++ b/mod/tinymce/languages/en.php
@@ -9,6 +9,7 @@ $english = array(
'tinymce:remove' => "Remove editor",
'tinymce:add' => "Add editor",
'tinymce:word_count' => 'Word count: ',
+ 'tinymce:lang_notice' => "Your site language is %s but it isn't installed for TinyMCE. Get it <a target=\"_blank\" href=\"%s\">here</a> and copy it in %s path. Then, <a href=\"%s\">flush the caches</a>.",
);
-add_translation("en", $english); \ No newline at end of file
+add_translation("en", $english);
diff --git a/mod/tinymce/start.php b/mod/tinymce/start.php
index 48625f456..6aba837e0 100644
--- a/mod/tinymce/start.php
+++ b/mod/tinymce/start.php
@@ -33,3 +33,15 @@ function tinymce_longtext_menu($hook, $type, $items, $vars) {
return $items;
}
+
+function tinymce_get_site_language() {
+
+ if ($site_language = elgg_get_config('language')) {
+ $path = elgg_get_plugins_path() . "tinymce/vendor/tinymce/jscripts/tiny_mce/langs";
+ if (file_exists("$path/$site_language.js")) {
+ return $site_language;
+ }
+ }
+
+ return 'en';
+}
diff --git a/mod/tinymce/views/default/js/tinymce.php b/mod/tinymce/views/default/js/tinymce.php
index e6e2865a5..51e99c223 100644
--- a/mod/tinymce/views/default/js/tinymce.php
+++ b/mod/tinymce/views/default/js/tinymce.php
@@ -38,6 +38,7 @@ elgg.tinymce.init = function() {
mode : "specific_textareas",
editor_selector : "elgg-input-longtext",
theme : "advanced",
+ language : "<?php echo tinymce_get_site_language(); ?>",
plugins : "lists,spellchecker,autosave,fullscreen,paste",
relative_urls : false,
remove_script_host : false,
@@ -86,4 +87,4 @@ elgg.tinymce.init = function() {
}
}
-elgg.register_hook_handler('init', 'system', elgg.tinymce.init); \ No newline at end of file
+elgg.register_hook_handler('init', 'system', elgg.tinymce.init);