aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/translation_editor/CHANGES.txt102
-rw-r--r--mod/translation_editor/README.txt21
-rw-r--r--mod/translation_editor/_graphics/flags/ar.pngbin0 -> 938 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/bg.pngbin0 -> 118 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/ca.pngbin0 -> 134 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/cs.pngbin0 -> 191 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/da.pngbin0 -> 130 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/de.pngbin0 -> 111 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/el.pngbin0 -> 189 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/en.pngbin0 -> 210 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/eo.pngbin0 -> 153 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/es.pngbin0 -> 241 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/et.pngbin0 -> 144 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/eu.pngbin0 -> 407 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/fa.pngbin0 -> 324 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/fi.pngbin0 -> 145 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/fo.pngbin0 -> 182 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/fr.pngbin0 -> 116 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/ga.pngbin0 -> 117 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/gl.pngbin0 -> 396 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/he.pngbin0 -> 165 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/hi.pngbin0 -> 171 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/hr.pngbin0 -> 304 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/hu.pngbin0 -> 119 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/id.pngbin0 -> 107 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/is.pngbin0 -> 157 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/it.pngbin0 -> 116 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/ja.pngbin0 -> 154 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/km.pngbin0 -> 273 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/ko.pngbin0 -> 567 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/lb.pngbin0 -> 119 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/lt.pngbin0 -> 147 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/lv.pngbin0 -> 144 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/mn.pngbin0 -> 238 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/nb.pngbin0 -> 128 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/nl.pngbin0 -> 121 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/nn.pngbin0 -> 128 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/pl.pngbin0 -> 113 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/pt-br.pngbin0 -> 313 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/pt-pt.pngbin0 -> 271 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/ro.pngbin0 -> 111 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/ru.pngbin0 -> 121 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/sco.pngbin0 -> 188 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/se.pngbin0 -> 219 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/sk.pngbin0 -> 259 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/sl.pngbin0 -> 197 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/sq.pngbin0 -> 266 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/sr.pngbin0 -> 475 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/sv.pngbin0 -> 144 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/tg.pngbin0 -> 211 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/th.pngbin0 -> 132 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/tl.pngbin0 -> 347 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/tr.pngbin0 -> 198 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/uk.pngbin0 -> 108 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/vi.pngbin0 -> 223 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/zh-hans.pngbin0 -> 262 bytes
-rw-r--r--mod/translation_editor/_graphics/flags/zh-hant.pngbin0 -> 174 bytes
-rw-r--r--mod/translation_editor/_graphics/key.gifbin0 -> 917 bytes
-rw-r--r--mod/translation_editor/actions/add_custom_key.php64
-rw-r--r--mod/translation_editor/actions/add_language.php19
-rw-r--r--mod/translation_editor/actions/delete.php20
-rw-r--r--mod/translation_editor/actions/delete_language.php26
-rw-r--r--mod/translation_editor/actions/disable_languages.php23
-rw-r--r--mod/translation_editor/actions/make_translation_editor.php23
-rw-r--r--mod/translation_editor/actions/merge.php29
-rw-r--r--mod/translation_editor/actions/translate.php76
-rw-r--r--mod/translation_editor/actions/translate_search.php84
-rw-r--r--mod/translation_editor/actions/unmake_translation_editor.php20
-rw-r--r--mod/translation_editor/languages/ca.php57
-rw-r--r--mod/translation_editor/languages/de.php56
-rw-r--r--mod/translation_editor/languages/en.php83
-rw-r--r--mod/translation_editor/languages/es.php59
-rw-r--r--mod/translation_editor/languages/fr.php80
-rw-r--r--mod/translation_editor/languages/nl.php56
-rw-r--r--mod/translation_editor/lib/events.php9
-rw-r--r--mod/translation_editor/lib/functions.php581
-rw-r--r--mod/translation_editor/lib/hooks.php45
-rw-r--r--mod/translation_editor/manifest.xml17
-rw-r--r--mod/translation_editor/pages/index.php64
-rw-r--r--mod/translation_editor/pages/search.php32
-rw-r--r--mod/translation_editor/start.php139
-rw-r--r--mod/translation_editor/views/default/core/settings/account/language.php42
-rw-r--r--mod/translation_editor/views/default/plugins/translation_editor/settings.php20
-rw-r--r--mod/translation_editor/views/default/translation_editor/add_custom_key.php21
-rw-r--r--mod/translation_editor/views/default/translation_editor/add_language.php167
-rw-r--r--mod/translation_editor/views/default/translation_editor/css/site.php99
-rw-r--r--mod/translation_editor/views/default/translation_editor/js/site.php41
-rw-r--r--mod/translation_editor/views/default/translation_editor/language_selector.php88
-rw-r--r--mod/translation_editor/views/default/translation_editor/plugin_edit.php147
-rw-r--r--mod/translation_editor/views/default/translation_editor/plugin_list.php84
-rw-r--r--mod/translation_editor/views/default/translation_editor/search.php43
-rw-r--r--mod/translation_editor/views/default/translation_editor/search_results.php78
92 files changed, 2615 insertions, 0 deletions
diff --git a/mod/translation_editor/CHANGES.txt b/mod/translation_editor/CHANGES.txt
new file mode 100644
index 000000000..a2a0e6431
--- /dev/null
+++ b/mod/translation_editor/CHANGES.txt
@@ -0,0 +1,102 @@
+= Version history =
+x.x:
+
+- added: german translation (thanks to Originalhardy http://community.elgg.org/pg/profile/Originalhardy)
+- changed: internal function for better performance
+- removed: some legacy code
+
+1.2.1 (2012-03-02):
+
+- fixed: CSS issue on plugin edit
+- fixed: custom translations not loaded in some cases
+- fixed: language selection (on settings) sometimes displays to many languages
+- fixed: not using an available function
+- fixed: using define in stead of string
+- fixed: issue where disabled languages could not be removed
+- changed: layout to be consistent with Elgg design
+- removed: some icons where replaced by Elgg default icons
+
+1.2 (2011-12-06):
+
+- added: French translation for version 1.1, thanks to Jean-Baptiste Duclos (http://community.elgg.org/pg/profile/Duclos)
+- fixed: a deadloop problem with detecting vsprintf aguments is some cases
+
+1.1 (2011-11-28):
+
+- added: event trigger on merge of a translation "language:merge" => "translation_editor"
+- fixed: page_handler issue with Elgg 1.8.1
+
+1.0 (2011-11-14):
+
+- added: check on missing params in sprintf strings
+- fixed: removing of custom translations failed due to missing JS function
+- fixed: depricated notice in add language form
+- fixed: translations reload on plugin enable/disable
+- fixed: translations reload when running upgrade.php
+- changed: links to merge and delete custom translation
+
+1.0 beta (2011-10-05):
+
+- added: shortcut link from translation search results to related plugins
+- added: breadcrumb navigation
+- changed: support for Elgg 1.8
+- changed: layout cleanup
+
+0.6 (2011-07-27):
+
+- added: key search
+- fixed: typo in translate action
+- changed: improved search performance
+
+0.5.4 (2011-05-31):
+
+- fixed: translation caching on multisite setup
+
+0.5.3 (2011-05-17):
+
+- changed: translations event moved to jQuery Live
+- changed: loading of translation now from one file
+
+0.5.2 (2011-04-05):
+
+- fixed: language save bug when only one language is available
+
+0.5.1 (2011-01-04):
+
+- fixed: division by zero error
+- fixed: disableing languages when simplecache is enabled
+- fixed: apache warning when no customkeys have been made yet
+- fixed: elgg_deprecated warning in start.php
+
+0.5 (2010-12-20):
+
+- added: disable a language
+- added: user will have no language selector (settings) option if only english is installed
+- added: add a custom language
+- added: search for translations
+- added: add custom translation keys
+- added: current site language in language list
+
+0.4:
+
+- added: jQuery save onChange textarea
+- added: security tokens (for Elgg 1.7)
+- added: admin option to delete translation
+- fixed: bug with unsupported data type when having the translator role
+- fixed: tools menu item not working (credit to Zacke)
+
+0.3 (2010-01-25):
+
+- added: allowedprotocols jaavscript
+- added: allowedtags attribute onclick for a
+- added: allowedtags attribute id for span
+
+0.2 (2010-01-19):
+
+- added: option to merge translations to a PHP/Elgg language file
+- added: column to see how many keys are translated
+- added: filter for custom translations
+
+0.1:
+
+- initial release \ No newline at end of file
diff --git a/mod/translation_editor/README.txt b/mod/translation_editor/README.txt
new file mode 100644
index 000000000..26f2e0eda
--- /dev/null
+++ b/mod/translation_editor/README.txt
@@ -0,0 +1,21 @@
+= Translation Editor =
+
+Manage translations
+
+== Contents ==
+
+1. Features
+2. Special thanks
+
+== 1. Features ==
+- Edit translations
+- Assign multiple translators
+- Add custom languages
+- Add custom keys
+- Caching of language files
+
+== 2. Special thanks ==
+Special thanks goes out to to following people:
+
+Jean-Baptiste Duclos (http://community.elgg.org/pg/profile/Duclos)
+For providing a French translation of version 1.1 \ No newline at end of file
diff --git a/mod/translation_editor/_graphics/flags/ar.png b/mod/translation_editor/_graphics/flags/ar.png
new file mode 100644
index 000000000..3d048ef71
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/ar.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/bg.png b/mod/translation_editor/_graphics/flags/bg.png
new file mode 100644
index 000000000..d7ad5438d
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/bg.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/ca.png b/mod/translation_editor/_graphics/flags/ca.png
new file mode 100644
index 000000000..772361d98
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/ca.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/cs.png b/mod/translation_editor/_graphics/flags/cs.png
new file mode 100644
index 000000000..15bc88d79
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/cs.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/da.png b/mod/translation_editor/_graphics/flags/da.png
new file mode 100644
index 000000000..1504e2131
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/da.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/de.png b/mod/translation_editor/_graphics/flags/de.png
new file mode 100644
index 000000000..41fea2599
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/de.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/el.png b/mod/translation_editor/_graphics/flags/el.png
new file mode 100644
index 000000000..64e2ebe78
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/el.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/en.png b/mod/translation_editor/_graphics/flags/en.png
new file mode 100644
index 000000000..84b934ab7
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/en.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/eo.png b/mod/translation_editor/_graphics/flags/eo.png
new file mode 100644
index 000000000..fde29543a
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/eo.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/es.png b/mod/translation_editor/_graphics/flags/es.png
new file mode 100644
index 000000000..bf2b5b834
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/es.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/et.png b/mod/translation_editor/_graphics/flags/et.png
new file mode 100644
index 000000000..6f01c6a1d
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/et.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/eu.png b/mod/translation_editor/_graphics/flags/eu.png
new file mode 100644
index 000000000..a58d68295
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/eu.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/fa.png b/mod/translation_editor/_graphics/flags/fa.png
new file mode 100644
index 000000000..69cebb7f2
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/fa.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/fi.png b/mod/translation_editor/_graphics/flags/fi.png
new file mode 100644
index 000000000..253fd4779
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/fi.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/fo.png b/mod/translation_editor/_graphics/flags/fo.png
new file mode 100644
index 000000000..cc8439c33
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/fo.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/fr.png b/mod/translation_editor/_graphics/flags/fr.png
new file mode 100644
index 000000000..58be00ac2
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/fr.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/ga.png b/mod/translation_editor/_graphics/flags/ga.png
new file mode 100644
index 000000000..ab14e96cf
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/ga.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/gl.png b/mod/translation_editor/_graphics/flags/gl.png
new file mode 100644
index 000000000..84a1802dd
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/gl.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/he.png b/mod/translation_editor/_graphics/flags/he.png
new file mode 100644
index 000000000..e32439c4f
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/he.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/hi.png b/mod/translation_editor/_graphics/flags/hi.png
new file mode 100644
index 000000000..d75f5597c
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/hi.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/hr.png b/mod/translation_editor/_graphics/flags/hr.png
new file mode 100644
index 000000000..24fa77a23
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/hr.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/hu.png b/mod/translation_editor/_graphics/flags/hu.png
new file mode 100644
index 000000000..d967480de
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/hu.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/id.png b/mod/translation_editor/_graphics/flags/id.png
new file mode 100644
index 000000000..6bf9bfec9
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/id.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/is.png b/mod/translation_editor/_graphics/flags/is.png
new file mode 100644
index 000000000..398745745
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/is.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/it.png b/mod/translation_editor/_graphics/flags/it.png
new file mode 100644
index 000000000..7131202d2
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/it.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/ja.png b/mod/translation_editor/_graphics/flags/ja.png
new file mode 100644
index 000000000..8eabe66e6
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/ja.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/km.png b/mod/translation_editor/_graphics/flags/km.png
new file mode 100644
index 000000000..af103289c
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/km.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/ko.png b/mod/translation_editor/_graphics/flags/ko.png
new file mode 100644
index 000000000..10a73bd36
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/ko.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/lb.png b/mod/translation_editor/_graphics/flags/lb.png
new file mode 100644
index 000000000..6e596bbaf
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/lb.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/lt.png b/mod/translation_editor/_graphics/flags/lt.png
new file mode 100644
index 000000000..a1bdc47d7
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/lt.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/lv.png b/mod/translation_editor/_graphics/flags/lv.png
new file mode 100644
index 000000000..f8adb5d9e
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/lv.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/mn.png b/mod/translation_editor/_graphics/flags/mn.png
new file mode 100644
index 000000000..355b43dae
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/mn.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/nb.png b/mod/translation_editor/_graphics/flags/nb.png
new file mode 100644
index 000000000..90335988c
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/nb.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/nl.png b/mod/translation_editor/_graphics/flags/nl.png
new file mode 100644
index 000000000..ad752ce06
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/nl.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/nn.png b/mod/translation_editor/_graphics/flags/nn.png
new file mode 100644
index 000000000..90335988c
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/nn.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/pl.png b/mod/translation_editor/_graphics/flags/pl.png
new file mode 100644
index 000000000..1a0988b95
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/pl.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/pt-br.png b/mod/translation_editor/_graphics/flags/pt-br.png
new file mode 100644
index 000000000..22a8df785
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/pt-br.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/pt-pt.png b/mod/translation_editor/_graphics/flags/pt-pt.png
new file mode 100644
index 000000000..66d5bd706
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/pt-pt.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/ro.png b/mod/translation_editor/_graphics/flags/ro.png
new file mode 100644
index 000000000..a5be3be42
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/ro.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/ru.png b/mod/translation_editor/_graphics/flags/ru.png
new file mode 100644
index 000000000..97c436d0c
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/ru.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/sco.png b/mod/translation_editor/_graphics/flags/sco.png
new file mode 100644
index 000000000..d3bd37a2f
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/sco.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/se.png b/mod/translation_editor/_graphics/flags/se.png
new file mode 100644
index 000000000..0d73a7014
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/se.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/sk.png b/mod/translation_editor/_graphics/flags/sk.png
new file mode 100644
index 000000000..5d303f762
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/sk.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/sl.png b/mod/translation_editor/_graphics/flags/sl.png
new file mode 100644
index 000000000..356442f4b
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/sl.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/sq.png b/mod/translation_editor/_graphics/flags/sq.png
new file mode 100644
index 000000000..3244bbd14
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/sq.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/sr.png b/mod/translation_editor/_graphics/flags/sr.png
new file mode 100644
index 000000000..bca54f1f7
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/sr.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/sv.png b/mod/translation_editor/_graphics/flags/sv.png
new file mode 100644
index 000000000..bb27ed13d
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/sv.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/tg.png b/mod/translation_editor/_graphics/flags/tg.png
new file mode 100644
index 000000000..9a377f4ff
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/tg.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/th.png b/mod/translation_editor/_graphics/flags/th.png
new file mode 100644
index 000000000..9e9abd29a
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/th.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/tl.png b/mod/translation_editor/_graphics/flags/tl.png
new file mode 100644
index 000000000..ffd461ddf
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/tl.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/tr.png b/mod/translation_editor/_graphics/flags/tr.png
new file mode 100644
index 000000000..60287a43e
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/tr.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/uk.png b/mod/translation_editor/_graphics/flags/uk.png
new file mode 100644
index 000000000..485b5d0f2
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/uk.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/vi.png b/mod/translation_editor/_graphics/flags/vi.png
new file mode 100644
index 000000000..2adcc2085
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/vi.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/zh-hans.png b/mod/translation_editor/_graphics/flags/zh-hans.png
new file mode 100644
index 000000000..36650640f
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/zh-hans.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/flags/zh-hant.png b/mod/translation_editor/_graphics/flags/zh-hant.png
new file mode 100644
index 000000000..9c75444a5
--- /dev/null
+++ b/mod/translation_editor/_graphics/flags/zh-hant.png
Binary files differ
diff --git a/mod/translation_editor/_graphics/key.gif b/mod/translation_editor/_graphics/key.gif
new file mode 100644
index 000000000..30a1d4a27
--- /dev/null
+++ b/mod/translation_editor/_graphics/key.gif
Binary files differ
diff --git a/mod/translation_editor/actions/add_custom_key.php b/mod/translation_editor/actions/add_custom_key.php
new file mode 100644
index 000000000..47269dfd2
--- /dev/null
+++ b/mod/translation_editor/actions/add_custom_key.php
@@ -0,0 +1,64 @@
+<?php
+ global $CONFIG;
+
+ admin_gatekeeper();
+
+ $key = get_input("key");
+ $translation = get_input("translation");
+
+ if(!empty($key) && !empty($translation)){
+ if(!is_numeric($key)){
+ if(preg_match("/^[a-zA-Z0-9_:]{1,}$/", $key)){
+ $exists = false;
+ if(array_key_exists($key, $CONFIG->translations["en"])){
+ $exists = true;
+ }
+
+ if(!$exists){
+ // save
+
+ $custom_translations = array();
+
+ if($custom_translations = translation_editor_get_plugin("en", "custom_keys")){
+ $custom_translations = $custom_translations["en"];
+ }
+
+ $custom_translations[$key] = $translation;
+
+ $base_dir = elgg_get_data_path() . "translation_editor" . DIRECTORY_SEPARATOR;
+ if(!file_exists($base_dir)){
+ mkdir($base_dir);
+ }
+
+ $location = $base_dir . "custom_keys" . DIRECTORY_SEPARATOR;
+ if(!file_exists($location)){
+ mkdir($location);
+ }
+
+ $file_contents = "<?php" . PHP_EOL;
+ $file_contents .= '$language = ';
+ $file_contents .= var_export($custom_translations, true);
+ $file_contents .= ';' . PHP_EOL;
+ $file_contents .= 'add_translation("en", $language);' . PHP_EOL;
+ $file_contents .= "?>";
+
+ if(file_put_contents($location . "en.php", $file_contents)){
+
+ system_message(elgg_echo("translation_editor:action:add_custom_key:success"));
+ } else {
+ register_error(elgg_echo("translation_editor:action:add_custom_key:file_error"));
+ }
+ } else {
+ register_error(elgg_echo("translation_editor:action:add_custom_key:exists"));
+ }
+ } else {
+ register_error(elgg_echo("translation_editor:action:add_custom_key:invalid_chars"));
+ }
+ } else {
+ register_error(elgg_echo("translation_editor:action:add_custom_key:key_numeric"));
+ }
+ } else {
+ register_error(elgg_echo("translation_editor:action:add_custom_key:missing_input"));
+ }
+
+ forward(REFERER); \ No newline at end of file
diff --git a/mod/translation_editor/actions/add_language.php b/mod/translation_editor/actions/add_language.php
new file mode 100644
index 000000000..4b324bee6
--- /dev/null
+++ b/mod/translation_editor/actions/add_language.php
@@ -0,0 +1,19 @@
+<?php
+
+ admin_gatekeeper();
+
+ $code = get_input("code");
+ if(!empty($code)){
+ if($custom_languages = elgg_get_plugin_setting("custom_languages", "translation_editor")){
+ $custom_languages = explode(",", $custom_languages);
+ $custom_languages[] = $code;
+
+ $code = implode(",", array_unique($custom_languages));
+
+ }
+
+ elgg_set_plugin_setting("custom_languages", $code, "translation_editor");
+ system_message(elgg_echo("translation_editor:action:add_language:success"));
+ }
+
+ forward(REFERER); \ No newline at end of file
diff --git a/mod/translation_editor/actions/delete.php b/mod/translation_editor/actions/delete.php
new file mode 100644
index 000000000..b965150e9
--- /dev/null
+++ b/mod/translation_editor/actions/delete.php
@@ -0,0 +1,20 @@
+<?php
+ admin_gatekeeper();
+
+ $lang = get_input("current_language");
+ $plugin = get_input("plugin");
+
+ if(!empty($lang) && !empty($plugin)){
+ if(translation_editor_delete_translation($lang, $plugin)){
+ // merge translations
+ translation_editor_merge_translations($lang, true);
+
+ system_message(elgg_echo("translation_editor:action:delete:success"));
+ } else {
+ register_error(elgg_echo("translation_editor:action:delete:error:delete"));
+ }
+ } else {
+ register_error(elgg_echo("translation_editor:action:delete:error:input"));
+ }
+
+ forward("translation_editor/" . $lang);
diff --git a/mod/translation_editor/actions/delete_language.php b/mod/translation_editor/actions/delete_language.php
new file mode 100644
index 000000000..77b8441f5
--- /dev/null
+++ b/mod/translation_editor/actions/delete_language.php
@@ -0,0 +1,26 @@
+<?php
+
+ admin_gatekeeper();
+
+ $language = get_input("language");
+ if(!empty($language) && ($language != "en")){
+
+ $completeness = translation_editor_get_language_completeness($language);
+ if($completeness == 0){
+ if($custom_languages = elgg_get_plugin_setting("custom_languages", "translation_editor")){
+ $custom_languages = explode(",", $custom_languages);
+
+ $index = array_search($language, $custom_languages);
+ if($index !== false ){
+ unset($custom_languages[$index]);
+
+ $code = implode(",", array_unique($custom_languages));
+
+ elgg_set_plugin_setting("custom_languages", $code, "translation_editor");
+ system_message(elgg_echo("translation_editor:action:delete_language:success"));
+ }
+ }
+ }
+ }
+
+ forward(REFERER); \ No newline at end of file
diff --git a/mod/translation_editor/actions/disable_languages.php b/mod/translation_editor/actions/disable_languages.php
new file mode 100644
index 000000000..04c3235f6
--- /dev/null
+++ b/mod/translation_editor/actions/disable_languages.php
@@ -0,0 +1,23 @@
+<?php
+
+ /**
+ * jQuery call to disable a set of languages
+ */
+
+ if(elgg_is_admin_logged_in()){
+ $disabled_languages = get_input("disabled_languages");
+
+ if(!empty($disabled_languages)){
+ if(is_array($disabled_languages)){
+ $temp_string = implode(",", $disabled_languages);
+ } else {
+ $temp_string = $disabled_languages;
+ }
+
+ elgg_set_plugin_setting(TRANSLATION_EDITOR_DISABLED_LANGUAGE, $temp_string, "translation_editor");
+ } else {
+ elgg_unset_plugin_setting(TRANSLATION_EDITOR_DISABLED_LANGUAGE, "translation_editor");
+ }
+ }
+
+ exit(); \ No newline at end of file
diff --git a/mod/translation_editor/actions/make_translation_editor.php b/mod/translation_editor/actions/make_translation_editor.php
new file mode 100644
index 000000000..5a5640c66
--- /dev/null
+++ b/mod/translation_editor/actions/make_translation_editor.php
@@ -0,0 +1,23 @@
+<?php
+
+ admin_gatekeeper();
+
+ $result = false;
+
+ $user = get_input("user");
+ $role = "translation_editor";
+
+ $user = get_entity($user);
+ if($user instanceof ElggUser){
+ if(create_metadata($user->guid, $role, true, "integer", $user->guid, ACCESS_PUBLIC)){
+ $result = true;
+ }
+ }
+
+ if(!$result){
+ register_error(elgg_echo("translation_editor:action:make_translation_editor:error"));
+ } else {
+ system_message(elgg_echo("translation_editor:action:make_translation_editor:success"));
+ }
+
+ forward(REFERER); \ No newline at end of file
diff --git a/mod/translation_editor/actions/merge.php b/mod/translation_editor/actions/merge.php
new file mode 100644
index 000000000..db1e75276
--- /dev/null
+++ b/mod/translation_editor/actions/merge.php
@@ -0,0 +1,29 @@
+<?php
+ gatekeeper();
+
+ $current_language = get_input("current_language");
+ $plugin = get_input("plugin");
+
+ if(translation_editor_is_translation_editor()){
+
+ // We'll be outputting a CSV
+ header("Content-Type: text/plain");
+
+ // It will be called $lang.php
+ header('Content-Disposition: attachment; filename="' . $current_language . '.php"');
+
+ $translation = translation_editor_get_plugin($current_language, $plugin);
+ $translation = $translation['current_language'];
+
+ echo "<?php" . PHP_EOL;
+ echo '$language = ';
+ echo var_export($translation);
+ echo ';' . PHP_EOL;
+ echo 'add_translation("' . $current_language . '", $language);' . PHP_EOL;
+
+ exit();
+
+ } else {
+ register_error(elgg_echo("transation_editor:action:translate:error:not_authorized"));
+ forward(REFERER);
+ }
diff --git a/mod/translation_editor/actions/translate.php b/mod/translation_editor/actions/translate.php
new file mode 100644
index 000000000..973d050d4
--- /dev/null
+++ b/mod/translation_editor/actions/translate.php
@@ -0,0 +1,76 @@
+<?php
+ global $CONFIG;
+
+ //action_gatekeeper();
+ gatekeeper();
+
+ // Fixes for KSES filtering
+ // fix to allow javascript in href
+ $CONFIG->allowedprotocols[] = "javascript";
+
+ // fix allowed tags
+ $CONFIG->allowedtags["a"]["onclick"] = array();
+ $CONFIG->allowedtags["span"]["id"] = array();
+
+ // get inputs
+ $current_language = get_input("current_language");
+ $translate_input = get_input("translation");
+ $plugin = get_input("plugin");
+ $jquery = get_input("jquery", false);
+
+ // Preparing jQuery result
+ $json_result = array();
+ $json_result["result"] = false;
+
+ if(translation_editor_is_translation_editor()){
+ if(!empty($current_language) && !empty($translate_input) && !empty($plugin)){
+ $translated = translation_editor_compare_translations($current_language, $translate_input);
+
+ if(!empty($translated)){
+ if(translation_editor_write_translation($current_language, $plugin, $translated)){
+ if(!$jquery){
+ system_message(elgg_echo("translation_editor:action:translate:success"));
+ } else {
+ $json_result["result"] = true;
+ }
+ } else {
+ if(!$jquery){
+ register_error(elgg_echo("translation_editor:action:translate:error:write"));
+ }
+ }
+ } else {
+ translation_editor_delete_translation($current_language, $plugin);
+ if(!$jquery){
+ system_message(elgg_echo("translation_editor:action:translate:no_changed_values"));
+ } else {
+ $json_result["result"] = true;
+ }
+ }
+
+ // merge translations
+ translation_editor_merge_translations($current_language, true);
+ } else {
+ if(!$jquery){
+ register_error(elgg_echo("translation_editor:action:translate:error:input"));
+ }
+ }
+ } else {
+ if(!$jquery){
+ register_error(elgg_echo("translation_editor:action:translate:error:not_authorized"));
+ }
+ }
+
+ if(!$jquery){
+ forward(REFERER);
+ } else {
+ // Send JSON data
+ $json_string = json_encode($json_result);
+
+ header("Content-Type: application/json; charset=UTF-8");
+ header("Content-Length: " . strlen($json_string));
+ header("Cache-Control: no-cache");
+ header("Pragma: no-cache");
+
+ echo $json_string;
+ exit();
+ }
diff --git a/mod/translation_editor/actions/translate_search.php b/mod/translation_editor/actions/translate_search.php
new file mode 100644
index 000000000..623828b39
--- /dev/null
+++ b/mod/translation_editor/actions/translate_search.php
@@ -0,0 +1,84 @@
+<?php
+ global $CONFIG;
+
+ //action_gatekeeper();
+ gatekeeper();
+
+ // Fixes for KSES filtering
+ // fix to allow javascript in href
+ $CONFIG->allowedprotocols[] = "javascript";
+
+ // fix allowed tags
+ $CONFIG->allowedtags["a"]["onclick"] = array();
+ $CONFIG->allowedtags["span"]["id"] = array();
+
+ // get inputs
+ $current_language = get_input("current_language");
+ $translation = get_input("translation");
+ $jquery = get_input("jquery", false);
+
+ // Preparing jQuery result
+ $json_result = array();
+ $json_result["result"] = false;
+
+ if(translation_editor_is_translation_editor()){
+ $trans = get_installed_translations();
+
+ if(!empty($current_language) && !empty($translation) && array_key_exists($current_language, $trans)){
+ foreach($translation as $plugin => $translate_input){
+ // merge with existing custom translations
+ if($custom_translation = translation_editor_read_translation($current_language, $plugin)){
+ $translate_input = array_merge($custom_translation, $translate_input);
+ }
+
+ $translated = translation_editor_compare_translations($current_language, $translate_input);
+
+ if(!empty($translated)){
+ if(translation_editor_write_translation($current_language, $plugin, $translated)){
+ if(!$jquery){
+ system_message(elgg_echo("translation_editor:action:translate:success"));
+ } else {
+ $json_result["result"] = true;
+ }
+ } else {
+ if(!$jquery){
+ register_error(elgg_echo("translation_editor:action:translate:error:write"));
+ }
+ }
+ } else {
+ translation_editor_delete_translation($current_language, $plugin);
+ if(!$jquery){
+ system_message(elgg_echo("translation_editor:action:translate:no_changed_values"));
+ } else {
+ $json_result["result"] = true;
+ }
+ }
+ }
+
+ // merge translations
+ translation_editor_merge_translations($current_language, true);
+ } else {
+ if(!$jquery){
+ register_error(elgg_echo("translation_editor:action:translate:error:input"));
+ }
+ }
+ } else {
+ if(!$jquery){
+ register_error(elgg_echo("translation_editor:action:translate:error:not_authorized"));
+ }
+ }
+
+ if(!$jquery){
+ forward(REFERER);
+ } else {
+ // Send JSON data
+ $json_string = json_encode($json_result);
+
+ header("Content-Type: application/json; charset=UTF-8");
+ header("Content-Length: " . strlen($json_string));
+ header("Cache-Control: no-cache");
+ header("Pragma: no-cache");
+
+ echo $json_string;
+ exit();
+ }
diff --git a/mod/translation_editor/actions/unmake_translation_editor.php b/mod/translation_editor/actions/unmake_translation_editor.php
new file mode 100644
index 000000000..1872d7f6c
--- /dev/null
+++ b/mod/translation_editor/actions/unmake_translation_editor.php
@@ -0,0 +1,20 @@
+<?php
+
+ admin_gatekeeper();
+
+ $result = false;
+
+ $user = get_input("user");
+ $user = get_entity($user);
+
+ if($user instanceof ElggUser){
+ unset($user->translation_editor);
+ $result = true;
+ }
+
+ if(!$result){
+ register_error(elgg_echo("translation_editor:action:unmake_translation_editor:error"));
+ } else {
+ system_message(elgg_echo("translation_editor:action:unmake_translation_editor:success"));
+ }
+ forward(REFERER);
diff --git a/mod/translation_editor/languages/ca.php b/mod/translation_editor/languages/ca.php
new file mode 100644
index 000000000..80ac88a17
--- /dev/null
+++ b/mod/translation_editor/languages/ca.php
@@ -0,0 +1,57 @@
+<?php
+$language = array (
+ 'translation_editor:language' => 'Idioma',
+ 'translation_editor:disabled' => 'Desactivar',
+ 'translation_editor:menu:title' => 'Editor de traduccions',
+ 'translation_editor:language_selector:title' => 'Selecciona l\'idioma que vols editar',
+ 'translation_editor:language_selector:add_language' => 'Afegir un nou idioma',
+ 'translation_editor:language_selector:remove_language:confirm' => 'Estàs segur de voler esborrar aquest idioma? Pots afegir-lo de nou igualment!',
+ 'translation_editor:language_selector:site_language' => 'Idioma del lloc',
+ 'translation_editor:plugin_list:title' => 'Selecciona un component a traduïr',
+ 'translation_editor:plugin_list:plugin' => 'Nom de l\'extensió',
+ 'translation_editor:plugin_list:total' => 'Claus totals',
+ 'translation_editor:plugin_list:exists' => 'Traduïdes',
+ 'translation_editor:plugin_list:custom' => 'Pròpies',
+ 'translation_editor:plugin_list:percentage' => 'Percentatge completat',
+ 'translation_editor:plugin_list:merge' => 'Fusionar a l\'arxiu PHP d\'idiomes',
+ 'translation_editor:plugin_list:delete' => 'Esborrar traducció',
+ 'translation_editor:plugin_list:delete:confirm' => 'Estàs segur de voler esborrar la traducció? Això no es pot desfer!',
+ 'translation_editor:search' => 'Resultats de la cerca',
+ 'translation_editor:forms:search:default' => 'Cercar una traducció',
+ 'translation_editor:search_results:no_results' => 'No s\'ha trobat cap traducció',
+ 'translation_editor:custom_keys:title' => 'Afegir una clau d\'idioma pròpia',
+ 'translation_editor:custom_keys:key' => 'Clau',
+ 'translation_editor:custom_keys:translation' => 'Traducció',
+ 'translation_editor:custom_keys:translation_info' => 'Noves claus s\'han de crear sempre com a traducció anglesa. Després de crear-la pots traduïr-la a altres idiomes',
+ 'translation_editor:plugin_edit:title' => 'Editar les traduccions per a l\'extensió:',
+ 'translation_editor:plugin_edit:show' => 'mostra',
+ 'translation_editor:plugin_edit:show:missing' => 'falta',
+ 'translation_editor:plugin_edit:show:equal' => 'igual',
+ 'translation_editor:plugin_edit:show:all' => 'totes',
+ 'translation_editor:plugin_edit:show:custom' => 'pròpies',
+ 'translation_editor:plugin_edit:show:params' => 'falten params',
+ 'translation_editor:action:translate:error:input' => 'Entrada incorrecta a l\'intentar afegir una traducció',
+ 'translation_editor:action:translate:no_changed_values' => 'No es necessita afegir cap traducció',
+ 'translation_editor:action:translate:error:write' => 'Error escrivint les traduccions',
+ 'translation_editor:action:translate:error:not_authorized' => 'No estàs autoritzada a traduïr',
+ 'translation_editor:action:translate:success' => 'Traduccions desades correctament',
+ 'translation_editor:action:make_translation_editor' => 'Fer-se Traductora',
+ 'translation_editor:action:make_translation_editor:success' => 'Feta traductora correctament',
+ 'translation_editor:action:make_translation_editor:error' => 'Error en fer a la usuària traductora',
+ 'translation_editor:action:unmake_translation_editor' => 'Desfer-se Traductora',
+ 'translation_editor:action:unmake_translation_editor:success' => 'Traductora eliminada correctament',
+ 'translation_editor:action:unmake_translation_editor:error' => 'Error en desfer a la usuària traductora',
+ 'translation_editor:action:delete:error:input' => 'Entrada incorrecta per esborrar traducció',
+ 'translation_editor:action:delete:error:delete' => 'Error en esborrar traducció',
+ 'translation_editor:action:delete:success' => 'Traducció esborrada correctament',
+ 'translation_editor:action:add_language:success' => 'Idioma afegit correctament',
+ 'translation_editor:action:delete_language:success' => 'Idioma esborrat correctament',
+ 'translation_editor:action:add_custom_key:success' => 'Clau pròpia afegida correctament',
+ 'translation_editor:action:add_custom_key:file_error' => 'Error en desar la clau pròpia a l\'arxiu',
+ 'translation_editor:action:add_custom_key:exists' => 'No es pot afegir aquesta clau ja que ja existeix. Introdueix una clau única',
+ 'translation_editor:action:add_custom_key:invalid_chars' => 'La clau conté caràcters invàlids. Només a-z 0-9, dos punts o guions són permesos.',
+ 'translation_editor:action:add_custom_key:key_numeric' => 'La clau no pot contenir només números',
+ 'translation_editor:action:add_custom_key:missing_input' => 'Entrada invàlida. Si us plau entra una clau i un idioma per defecte (anglès)',
+ 'translation_editor:settings:everybody_translate' => 'Totes les traduccions',
+);
+add_translation("ca", $language); \ No newline at end of file
diff --git a/mod/translation_editor/languages/de.php b/mod/translation_editor/languages/de.php
new file mode 100644
index 000000000..d7d6b80f4
--- /dev/null
+++ b/mod/translation_editor/languages/de.php
@@ -0,0 +1,56 @@
+<?php
+$language = array (
+ 'translation_editor:language' => 'Sprache',
+ 'translation_editor:disabled' => 'Ausschalten',
+ 'translation_editor:menu:title' => 'Ãœbersetzungseditor',
+ 'translation_editor:language_selector:title' => 'Wähle die Sprache, die du bearbeiten möchtest',
+ 'translation_editor:language_selector:add_language' => 'Füge eine neue Sprache hinzu',
+ 'translation_editor:language_selector:remove_language:confirm' => 'Bist du sicher, dass du die Sprache löschen möchtest? Du kannst sie jederzeit wieder hinzufügen.',
+ 'translation_editor:language_selector:site_language' => 'Sprache der Community',
+ 'translation_editor:plugin_list:title' => 'Wähle eine Komponente für zur Übersetzung',
+ 'translation_editor:plugin_list:plugin' => 'Pluginname',
+ 'translation_editor:plugin_list:total' => 'Gesamteinträge',
+ 'translation_editor:plugin_list:exists' => 'Ãœbersetzt',
+ 'translation_editor:plugin_list:custom' => 'Selbst erstellt',
+ 'translation_editor:plugin_list:percentage' => '% Komplett',
+ 'translation_editor:plugin_list:merge' => 'Kombiniere zu einer PHP-Datei',
+ 'translation_editor:plugin_list:delete' => 'Lösche Übersetzung',
+ 'translation_editor:plugin_list:delete:confirm' => 'Möchtest du wirklich diese Übersetzung löschen? Das kann nicht rückgängig gemacht werden!',
+ 'translation_editor:search' => 'Suchergebnis',
+ 'translation_editor:forms:search:default' => 'Finde eine Ãœbersetzung',
+ 'translation_editor:search_results:no_results' => 'Kein Ãœbersetzung gefunden',
+ 'translation_editor:custom_keys:title' => 'Füge neuen Sprachschlüssel hinzu',
+ 'translation_editor:custom_keys:key' => 'Schlüssel',
+ 'translation_editor:custom_keys:translation' => 'Ãœbersetzung',
+ 'translation_editor:custom_keys:translation_info' => 'Neue Schlüssel werden immer als englische Übersetzung erstellt. Danach kannst du sie in andere Sprachen übersetzen.',
+ 'translation_editor:plugin_edit:title' => 'Bearbeite die Übersetzung für das Plugin:',
+ 'translation_editor:plugin_edit:show' => 'zeige',
+ 'translation_editor:plugin_edit:show:missing' => 'zu tun',
+ 'translation_editor:plugin_edit:show:equal' => 'identisch',
+ 'translation_editor:plugin_edit:show:all' => 'alle',
+ 'translation_editor:plugin_edit:show:custom' => 'übersetzt',
+ 'translation_editor:plugin_edit:show:params' => 'fehlender Parameter',
+ 'translation_editor:action:translate:error:input' => 'Falsche Eingabe, um eine neue Übersetzung hinzuzufügen',
+ 'translation_editor:action:translate:no_changed_values' => 'Keine Ãœbersetzung erforderlich.',
+ 'translation_editor:action:translate:error:write' => 'Fehler beim Speichern der Ãœbersetzung',
+ 'translation_editor:action:translate:error:not_authorized' => 'Du bist nicht zum Ãœbersetzen authorisiert',
+ 'translation_editor:action:translate:success' => 'Ãœbersetzung erfolgreich gespeichert',
+ 'translation_editor:action:make_translation_editor' => 'Zum Ãœbersetzer machen',
+ 'translation_editor:action:make_translation_editor:success' => 'Erfolgreich zum Ãœbersetzer gemacht',
+ 'translation_editor:action:make_translation_editor:error' => 'Fehler beim Hinzufügen der Übersetzerrolle.',
+ 'translation_editor:action:unmake_translation_editor' => 'Ãœbersetzerrolle entfernen',
+ 'translation_editor:action:unmake_translation_editor:success' => 'Erfolgreich Ãœbersetzerrolle entfernt.',
+ 'translation_editor:action:unmake_translation_editor:error' => 'Fehler beim Entfernen der Ãœbersetzerrolle.',
+ 'translation_editor:action:delete:error:input' => 'Falsche Eingabe, um eine Übersetzung zu löschen',
+ 'translation_editor:action:delete:error:delete' => 'Fehler beim Löschen der Übersetzung.',
+ 'translation_editor:action:delete:success' => 'Übersetzung erfolgreich gelöscht',
+ 'translation_editor:action:add_language:success' => 'Sprache erfolgreich hinzugefügt',
+ 'translation_editor:action:delete_language:success' => 'Sprache erfolgreich gelöscht',
+ 'translation_editor:action:add_custom_key:success' => 'Neuer Schlüssel erfolgreich hinzugefügt.',
+ 'translation_editor:action:add_custom_key:file_error' => 'Fehler beim Speichern des selbst erstellten Schlüssels in die Datei.',
+ 'translation_editor:action:add_custom_key:exists' => 'Kann einen existierenden Schlüssel nicht erstellen. Bitte gib einen eindeutigen Schlüssel ein.',
+ 'translation_editor:action:add_custom_key:invalid_chars' => 'Schlüssel enthält ungültige Zeichen. Nur a-z, 0-9, Doppelpunkt und Unterstrich sind erlaubt.',
+ 'translation_editor:action:add_custom_key:key_numeric' => 'Schlüssel darf nur Zahlen enthalten.',
+ 'translation_editor:action:add_custom_key:missing_input' => 'Falsche Eingabe. Bitte gib einen Schlüssel und eine englische Übersetzung ein.',
+);
+add_translation("de", $language); \ No newline at end of file
diff --git a/mod/translation_editor/languages/en.php b/mod/translation_editor/languages/en.php
new file mode 100644
index 000000000..8b358411b
--- /dev/null
+++ b/mod/translation_editor/languages/en.php
@@ -0,0 +1,83 @@
+<?php
+
+ $english = array(
+ //'translation_editor' => "Translation Editor",
+
+ // global
+ 'translation_editor:language' => "Language",
+ 'translation_editor:disabled' => "Disable",
+
+ // menu
+ 'translation_editor:menu:title' => "Translation Editor",
+
+ // views
+ // language selector
+ 'translation_editor:language_selector:title' => "Select the language you wish to edit",
+ 'translation_editor:language_selector:add_language' => "Add a new language",
+ 'translation_editor:language_selector:remove_language:confirm' => "Are you sure you wish to remove this language? You can always add it again!",
+ 'translation_editor:language_selector:site_language' => "Site language",
+
+ // plugins list
+ 'translation_editor:plugin_list:title' => "Select a component to translate",
+ 'translation_editor:plugin_list:plugin' => "Plugin name",
+ 'translation_editor:plugin_list:total' => "Total keys",
+ 'translation_editor:plugin_list:exists' => "Translated",
+ 'translation_editor:plugin_list:custom' => "Custom",
+ 'translation_editor:plugin_list:percentage' => "Percentage complete",
+
+ 'translation_editor:plugin_list:merge' => "Merge to PHP language file",
+ 'translation_editor:plugin_list:delete' => "Delete translation",
+ 'translation_editor:plugin_list:delete:confirm' => "Are you sure you wish to delete the translation? This cannot be undone!",
+
+ // search
+ 'translation_editor:search' => "Search results",
+ 'translation_editor:forms:search:default' => "Find a translation",
+ 'translation_editor:search_results:no_results' => "No translation found",
+
+ // custom key
+ 'translation_editor:custom_keys:title' => "Add a custom language key",
+ 'translation_editor:custom_keys:key' => "Key",
+ 'translation_editor:custom_keys:translation' => "Translation",
+ 'translation_editor:custom_keys:translation_info' => "New keys will always be created as an English translation. After creation you can translate it to other languages.",
+
+ 'translation_editor:plugin_edit:title' => "Edit the translations for plugin:",
+ 'translation_editor:plugin_edit:show' => "show",
+ 'translation_editor:plugin_edit:show:missing' => "missing",
+ 'translation_editor:plugin_edit:show:equal' => "equal",
+ 'translation_editor:plugin_edit:show:all' => "all",
+ 'translation_editor:plugin_edit:show:custom' => "custom",
+ 'translation_editor:plugin_edit:show:params' => "missing params",
+
+ // actions
+ 'translation_editor:action:translate:error:input' => "Incorrect input provided to add a translation",
+ 'translation_editor:action:translate:no_changed_values' => "No translations needed to be added",
+ 'translation_editor:action:translate:error:write' => "Error while writing the translations",
+ 'translation_editor:action:translate:error:not_authorized' => "You are not authorized to translate",
+ 'translation_editor:action:translate:success' => "Translations saved successfully",
+
+ 'translation_editor:action:make_translation_editor' => "Make Translator",
+ 'translation_editor:action:make_translation_editor:success' => "Succesfully made a translator",
+ 'translation_editor:action:make_translation_editor:error' => "Error while making the user a translator",
+ 'translation_editor:action:unmake_translation_editor' => "UnMake Translator",
+ 'translation_editor:action:unmake_translation_editor:success' => "Succesfully removed translator",
+ 'translation_editor:action:unmake_translation_editor:error' => "Error while removing the translator role",
+
+ 'translation_editor:action:delete:error:input' => "Incorrect input to delete translation",
+ 'translation_editor:action:delete:error:delete' => "Error while deleting translation",
+ 'translation_editor:action:delete:success' => "Translation successfully deleted",
+
+ 'translation_editor:action:add_language:success' => "Language successfully added",
+ 'translation_editor:action:delete_language:success' => "Language successfully removed",
+
+ 'translation_editor:action:add_custom_key:success' => "Custom key successfully added",
+ 'translation_editor:action:add_custom_key:file_error' => "Error when saving the custom key to the file",
+ 'translation_editor:action:add_custom_key:exists' => "Can't add this key as it already exists. Enter a unique key.",
+ 'translation_editor:action:add_custom_key:invalid_chars' => "Key contains invalid characters. Only a-z, 0-9, colon or underscore are allowed.",
+ 'translation_editor:action:add_custom_key:key_numeric' => "Key can not contain only numbers",
+ 'translation_editor:action:add_custom_key:missing_input' => "Invalid input. Please enter a key and a default (English) translation.",
+
+ // settings
+ 'translation_editor:settings:everybody_translate' => "Everybody translate",
+ );
+
+ add_translation("en", $english);
diff --git a/mod/translation_editor/languages/es.php b/mod/translation_editor/languages/es.php
new file mode 100644
index 000000000..8c942e470
--- /dev/null
+++ b/mod/translation_editor/languages/es.php
@@ -0,0 +1,59 @@
+<?php
+$es = array (
+ 'translation_editor:language' => 'Idioma',
+ 'translation_editor:disabled' => 'Deshabilita',
+ 'translation_editor:menu:title' => 'Editor de traducción',
+ 'translation_editor:language_selector:title' => 'Selecciona el idioma que quieres editar',
+ 'translation_editor:language_selector:add_language' => 'Añade un nuevo idioma',
+ 'translation_editor:language_selector:remove_language:confirm' => '¿Estás seguro que quieres eliminar este idioma? ¡Puedes volver a añadirlo luego!',
+ 'translation_editor:language_selector:site_language' => 'Idioma del sitio',
+ 'translation_editor:plugin_list:title' => 'Selecciona un componente a traducir',
+ 'translation_editor:plugin_list:plugin' => 'Nombre de la extensión',
+ 'translation_editor:plugin_list:total' => 'Claves totales',
+ 'translation_editor:plugin_list:exists' => 'Traducido',
+ 'translation_editor:plugin_list:custom' => 'Personalizado',
+ 'translation_editor:plugin_list:percentage' => 'Porcentaje completado',
+ 'translation_editor:plugin_list:merge' => 'Mezcla en un fichero de idioma PHP',
+ 'translation_editor:plugin_list:delete' => 'Elimina traducción',
+ 'translation_editor:plugin_list:delete:confirm' => '¿Estás seguro de que quieres eliminar la traducción? ¡Esto no se puede deshacer!',
+ 'translation_editor:search' => 'Resultados de la búsqueda',
+ 'translation_editor:forms:search:default' => 'Encuentra una traducción',
+ 'translation_editor:search_results:no_results' => 'No se ha encontrado la traducción',
+ 'translation_editor:custom_keys:title' => 'Añade una clave de lenguage personalizada',
+ 'translation_editor:custom_keys:key' => 'Clave',
+ 'translation_editor:custom_keys:translation' => 'Traducción',
+ 'translation_editor:custom_keys:translation_info' => 'Se crearán nuevas claves con la traducción inglesa. Después de crearse puedes traducirlas a otros idiomas.',
+ 'translation_editor:plugin_edit:title' => 'Edita las traducciones para la extensión:',
+ 'translation_editor:plugin_edit:show' => 'muestra',
+ 'translation_editor:plugin_edit:show:missing' => 'falta',
+ 'translation_editor:plugin_edit:show:equal' => 'igual',
+ 'translation_editor:plugin_edit:show:all' => 'todo',
+ 'translation_editor:plugin_edit:show:custom' => 'personalizado',
+ 'translation_editor:plugin_edit:show:params' => 'faltan parámetros',
+ 'translation_editor:action:translate:error:input' => 'Entrada inválida para añadir una traducción',
+ 'translation_editor:action:translate:no_changed_values' => 'No es necesario añadir nuevas traducciones',
+ 'translation_editor:action:translate:error:write' => 'Error mientras se escribían las traducciones',
+ 'translation_editor:action:translate:error:not_authorized' => 'No estás autorizado a traducir',
+ 'translation_editor:action:translate:success' => 'Las traducciones se han guardado satisfactoriamente',
+ 'translation_editor:action:make_translation_editor' => 'Dar permisos de traducción',
+ 'translation_editor:action:make_translation_editor:success' => 'Ahora es traductor',
+ 'translation_editor:action:make_translation_editor:error' => 'Error mientras se daban permisos de traducción',
+ 'translation_editor:action:unmake_translation_editor' => 'Quitar permisos de traducción',
+ 'translation_editor:action:unmake_translation_editor:success' => 'Ya no es traductor',
+ 'translation_editor:action:unmake_translation_editor:error' => 'Error mientras se quitaban los permisos de traductor',
+ 'translation_editor:action:delete:error:input' => 'Entrada incorrecta al eliminar traducción',
+ 'translation_editor:action:delete:error:delete' => 'Error mientras se eliminaba la traducción',
+ 'translation_editor:action:delete:success' => 'Traducción eliminada correctamente',
+ 'translation_editor:action:add_language:success' => 'Idioma añadido satisfactoriamente',
+ 'translation_editor:action:delete_language:success' => 'Idioma eliminado satisfactoriamente',
+ 'translation_editor:action:add_custom_key:success' => 'Clave personalizada añadida satisfactoriamente',
+ 'translation_editor:action:add_custom_key:file_error' => 'Error mientras se guarda la clave personalizada en el fichero',
+ 'translation_editor:action:add_custom_key:exists' => 'No se puede añadir la clave porque ya existe. Entra una clave única.',
+ 'translation_editor:action:add_custom_key:invalid_chars' => 'La clave contiene caracteres inválidos. Sólo a-z, 0-9, dos puntos o barra baja son permitidos.',
+ 'translation_editor:action:add_custom_key:key_numeric' => 'La clave no puede contener sólo números',
+ 'translation_editor:action:add_custom_key:missing_input' => 'Entrada no válida. Por favor, entre una clave y una traducción por defecto (en inglés).',
+ 'translation_editor:settings:everybody_translate' => 'Todo el mundo traduce',
+);
+
+add_translation("es", $es);
+
diff --git a/mod/translation_editor/languages/fr.php b/mod/translation_editor/languages/fr.php
new file mode 100644
index 000000000..fda3c5237
--- /dev/null
+++ b/mod/translation_editor/languages/fr.php
@@ -0,0 +1,80 @@
+<?php
+
+$language = array (
+ //'translation_editor' => "Translation Editor",
+
+ // global
+ 'translation_editor:language' => 'Langage',
+ 'translation_editor:disabled' => 'Indisponible',
+
+ // menu
+ 'translation_editor:menu:title' => 'Editeur de traduction',
+
+ // views
+ // language selector
+ 'translation_editor:language_selector:title' => 'Sélectionner le langage que vous souhaitez édité',
+ 'translation_editor:language_selector:add_language' => 'Ajout d\'un nouveau langage',
+ 'translation_editor:language_selector:remove_language:confirm' => 'Etes-vous sûr de vouloir enlever ce langage ? Vous pouvez toujours l\'ajouter à nouveau !',
+ 'translation_editor:language_selector:site_language' => 'Langage du site',
+
+ // plugins list
+ 'translation_editor:plugin_list:title' => 'Sélectionner un composant à traduire',
+ 'translation_editor:plugin_list:plugin' => 'Nom du plugin',
+ 'translation_editor:plugin_list:total' => 'Total des Clés',
+ 'translation_editor:plugin_list:exists' => 'Traduit',
+ 'translation_editor:plugin_list:custom' => 'Personnalisation',
+ 'translation_editor:plugin_list:percentage' => 'Pourcentage de complètement',
+
+ 'translation_editor:plugin_list:merge' => 'Fusionner au fichier langage PHP',
+ 'translation_editor:plugin_list:delete' => 'Effacer une traduction',
+ 'translation_editor:plugin_list:delete:confirm' => 'Etes-vous sûr de vouloir effacer ce langage ? Vous ne pourrez pas revenir sur votre choix !',
+
+ // search
+ 'translation_editor:search' => 'Cherche des résultats',
+ 'translation_editor:forms:search:default' => 'Trouver une traduction',
+ 'translation_editor:search_results:no_results' => 'Aucune traduction trouvé',
+
+ // custom key
+ 'translation_editor:custom_keys:title' => 'Ajout d\'une clé langage personnalisé',
+ 'translation_editor:custom_keys:key' => 'Clé',
+ 'translation_editor:custom_keys:translation' => 'Traduction,',
+ 'translation_editor:custom_keys:translation_info' => 'Les nouvelles clés seront toujours créées tant que que traduction anglaise. Après la création vous pouvez les traduire dans un autre langage.',
+
+ 'translation_editor:plugin_edit:title' => 'Editer la traduction pour le plugin',
+ 'translation_editor:plugin_edit:show' => 'Montrer',
+ 'translation_editor:plugin_edit:show:missing' => 'Manque',
+ 'translation_editor:plugin_edit:show:equal' => 'égal',
+ 'translation_editor:plugin_edit:show:all' => 'Tous',
+ 'translation_editor:plugin_edit:show:custom' => 'Personnalisé',
+ 'translation_editor:plugin_edit:show:params' => 'Paramètres manquant',
+
+ // actions
+ 'translation_editor:action:translate:error:input' => 'Une entrée incorrecte revient à ajouter une traduction',
+ 'translation_editor:action:translate:no_changed_values' => 'Aucune traduction n\'a besoin d\'être ajouté',
+ 'translation_editor:action:translate:error:write' => 'Erreur pendant l\'écriture des traductions',
+ 'translation_editor:action:translate:error:not_authorized' => 'Vous n\'êtes pas autorisé à traduire',
+ 'translation_editor:action:translate:success' => 'Les traduction ont été sauvegardée avec succès',
+
+ 'translation_editor:action:make_translation_editor' => 'Faire un fichier traduction',
+ 'translation_editor:action:make_translation_editor:success' => 'Fichier traduction fait avec succès',
+ 'translation_editor:action:make_translation_editor:error' => 'Erreur pendant la fabrication du fichier traduction de l\'utilisateur',
+ 'translation_editor:action:unmake_translation_editor' => 'Défaire le fichier traduction',
+ 'translation_editor:action:unmake_translation_editor:success' => 'Fichier traduction enlevé avec succès',
+ 'translation_editor:action:unmake_translation_editor:error' => 'Erreur pendant retirement du role du fichier de traduction',
+
+ 'translation_editor:action:delete:error:input' => 'Entrée incorrecte pour effacer la traduction',
+ 'translation_editor:action:delete:error:delete' => 'Erreur durant l\'effacement de la traduction',
+ 'translation_editor:action:delete:success' => 'Traduction effacé avec succès',
+
+ 'translation_editor:action:add_language:success' => 'Langage ajouté avec succès',
+ 'translation_editor:action:delete_language:success' => 'Langage enlevé avec succès',
+
+ 'translation_editor:action:add_custom_key:success' => 'La clé personnalisé ajoutée avec succès',
+ 'translation_editor:action:add_custom_key:file_error' => 'Erreur lors de la sauvegarde de la clé personnalisé dans le fichier',
+ 'translation_editor:action:add_custom_key:exists' => 'Impossible d\'ajouter cet clé, car elle existe déjà. Entrer une clé unique.',
+ 'translation_editor:action:add_custom_key:invalid_chars' => 'Une clé contient des caractères invalides. Seuls les caractères a-z, 0-9 les virgules "," et souligné "_" sont admis.',
+ 'translation_editor:action:add_custom_key:key_numeric' => 'Une clé ne peut contenir que des chiffres',
+ 'translation_editor:action:add_custom_key:missing_input' => 'Entrée invalide. Merci d\'entrer une clé (anglaise) et une traduction par défault',
+);
+add_translation("fr", $language);
+?> \ No newline at end of file
diff --git a/mod/translation_editor/languages/nl.php b/mod/translation_editor/languages/nl.php
new file mode 100644
index 000000000..114094dbe
--- /dev/null
+++ b/mod/translation_editor/languages/nl.php
@@ -0,0 +1,56 @@
+<?php
+$language = array (
+ 'translation_editor:language' => 'Taal',
+ 'translation_editor:disabled' => 'Uitschakelen',
+ 'translation_editor:search' => 'Zoekresultaten',
+ 'translation_editor:forms:search:default' => 'Zoek een vertaling',
+ 'translation_editor:search_results:no_results' => 'Geen vertalingen gevonden',
+ 'translation_editor:custom_keys:title' => 'Voeg een custom taal sleutel toe',
+ 'translation_editor:custom_keys:key' => 'Sleutel',
+ 'translation_editor:custom_keys:translation' => 'Vertaling',
+ 'translation_editor:custom_keys:translation_info' => 'Nieuwe sleutels zullen altijd aangemaakt worden als een Engelse taalsleutel. Nadat deze is aangemaakt kan het in andere talen worden vertaald.',
+ 'translation_editor:action:translate:error:input' => 'Onjuiste invoer voor het toevoegen van een vertaling',
+ 'translation_editor:action:translate:error:write' => 'Fout tijdens wegschrijven van vertalingen',
+ 'translation_editor:action:translate:error:not_authorized' => 'Je bent niet geautoriseerd als vertaler',
+ 'translation_editor:action:translate:success' => 'Vertalingen opgeslagen',
+ 'translation_editor:action:make_translation_editor:success' => 'Vertaler toegevoegd',
+ 'translation_editor:action:unmake_translation_editor' => 'Verwijder vertaler',
+ 'translation_editor:action:unmake_translation_editor:success' => 'Vertaler rol verwijderd',
+ 'translation_editor:action:add_custom_key:success' => 'Custom sleutel toegevoegd',
+ 'translation_editor:action:add_custom_key:file_error' => 'Fout tijdens wegschrijven van de custom sleutel',
+ 'translation_editor:action:add_custom_key:exists' => 'Deze sleutel bestaat al. Voer een unieke sleutel in.',
+ 'translation_editor:action:add_custom_key:invalid_chars' => 'De sleutel bevat ongeldige karakters. Alleen a-z, 0-9, dubbele punt of underscore zijn toegestaan.',
+ 'translation_editor:action:add_custom_key:key_numeric' => 'Sleutel mag niet uit enkel getallen bestaan',
+ 'translation_editor:action:add_custom_key:missing_input' => 'Ongeldige invoer. Voer een sleutel en een standaard (Engelse) vertaling in.',
+ 'translation_editor:plugin_list:delete' => 'Verwijder vertaling',
+ 'translation_editor:plugin_list:delete:confirm' => 'Weet je zeker dat je de vertaling wilt verwijderen? Dit kan niet ongedaan gemaakt worden!',
+ 'translation_editor:action:delete:error:input' => 'Onjuiste invoer om de vertaling te verwijderen',
+ 'translation_editor:action:delete:error:delete' => 'Fout tijden het verwijderen van de vertaling',
+ 'translation_editor:action:delete:success' => 'Vertaling succesvol verwijderd',
+ 'translation_editor:menu:title' => 'Vertaalmodule',
+ 'translation_editor:language_selector:title' => 'Selecteer de taal die je wilt bewerken',
+ 'translation_editor:language_selector:add_language' => 'Nieuwe taal toevoegen',
+ 'translation_editor:language_selector:remove_language:confirm' => 'Weet u zeker dat u deze taal wilt verwijderen? U kunt deze altijd later weer toevoegen!',
+ 'translation_editor:plugin_list:title' => 'Selecteer een component om te vertalen',
+ 'translation_editor:plugin_list:plugin' => 'Plugin naam',
+ 'translation_editor:plugin_list:total' => 'Totaal sleutels',
+ 'translation_editor:plugin_list:exists' => 'Vertaald',
+ 'translation_editor:plugin_list:custom' => 'Aangepast',
+ 'translation_editor:plugin_list:percentage' => 'Percentage compleet',
+ 'translation_editor:plugin_list:merge' => 'Samenvoegen in een PHP taal bestand',
+ 'translation_editor:plugin_edit:title' => 'Bewerkt de vertalingen voor de plugin:',
+ 'translation_editor:plugin_edit:show' => 'toon',
+ 'translation_editor:plugin_edit:show:missing' => 'ontbrekend',
+ 'translation_editor:plugin_edit:show:equal' => 'gelijk',
+ 'translation_editor:plugin_edit:show:all' => 'alle',
+ 'translation_editor:plugin_edit:show:custom' => 'aangepast',
+ 'translation_editor:plugin_edit:show:params' => 'ontbrekende variabele',
+ 'translation_editor:action:translate:no_changed_values' => 'het was niet nodig vertalingen toe te voegen',
+ 'translation_editor:action:make_translation_editor' => 'Maak vertaler',
+ 'translation_editor:action:make_translation_editor:error' => 'Fout tijdens het toewijzen van de vertaler',
+ 'translation_editor:action:unmake_translation_editor:error' => 'Fout tijdens het verwijderen van de vertaler rol',
+ 'translation_editor:action:add_language:success' => 'Taal succesvol toegevoegd',
+ 'translation_editor:action:delete_language:success' => 'Taal succesvol verwijderd',
+ 'translation_editor:language_selector:site_language' => 'Site taal',
+);
+add_translation("nl", $language);
diff --git a/mod/translation_editor/lib/events.php b/mod/translation_editor/lib/events.php
new file mode 100644
index 000000000..21492088c
--- /dev/null
+++ b/mod/translation_editor/lib/events.php
@@ -0,0 +1,9 @@
+<?php
+
+ function translation_editor_upgrade_event($event, $type, $object){
+
+ if(defined("UPGRADING") && (UPGRADING == "upgrading")){
+ // call action hook function to avoid coding the same thing twice
+ translation_editor_actions_hook("action", "upgrading", null, null);
+ }
+ } \ No newline at end of file
diff --git a/mod/translation_editor/lib/functions.php b/mod/translation_editor/lib/functions.php
new file mode 100644
index 000000000..2c12c9dad
--- /dev/null
+++ b/mod/translation_editor/lib/functions.php
@@ -0,0 +1,581 @@
+<?php
+
+ /**
+ * Returns array of all available plugins and their individual language keys
+ *
+ * @param string $current_language
+ *
+ * @return array || false
+ */
+ function translation_editor_get_plugins($current_language){
+ global $CONFIG;
+
+ $result = false;
+
+ if(!empty($current_language)){
+ translation_editor_reload_all_translations();
+ translation_editor_load_translations($current_language);
+
+ $result = array();
+ $core = array();
+ $custom_keys = array();
+ $plugins_result = array();
+
+ $backup_full = $CONFIG->translations;
+ $plugins = elgg_get_plugins();
+
+ // Core translation
+ $CONFIG->translations = array();
+ $plugin_language = $CONFIG->path . "languages" . DIRECTORY_SEPARATOR . "en.php";
+
+ if(file_exists($plugin_language)){
+ include($plugin_language);
+
+ unset($CONFIG->translations["en"][""]);
+
+ $plugin_keys = $CONFIG->translations["en"];
+
+ $key_count = count($plugin_keys);
+
+ if(array_key_exists($current_language, $backup_full)){
+ $exists_count = $key_count - count(array_diff_key($plugin_keys, $backup_full[$current_language]));
+ } else {
+ $exists_count = 0;
+ }
+
+ if($custom_content = translation_editor_read_translation($current_language, "core")){
+ $custom_count = count($custom_content);
+ } else {
+ $custom_count = 0;
+ }
+
+ $core["core"]["total"] = $key_count;
+ $core["core"]["exists"] = $exists_count;
+ $core["core"]["custom"] = $custom_count;
+ }
+
+ // Custom Keys
+ $CONFIG->translations = array();
+ $custom_keys_original = $CONFIG->dataroot . "translation_editor" . DIRECTORY_SEPARATOR . "custom_keys" . DIRECTORY_SEPARATOR . "en.php";
+
+ if(file_exists($custom_keys_original)){
+ include($custom_keys_original);
+
+ unset($CONFIG->translations["en"][""]);
+
+ $plugin_keys = $CONFIG->translations["en"];
+
+ $key_count = count($plugin_keys);
+
+ if(array_key_exists($current_language, $backup_full)){
+ $exists_count = $key_count - count(array_diff_key($plugin_keys, $backup_full[$current_language]));
+ } else {
+ $exists_count = 0;
+ }
+
+ if($custom_content = translation_editor_read_translation($current_language, "custom_keys")){
+ $custom_count = count($custom_content);
+ } else {
+ $custom_count = 0;
+ }
+
+ $custom_keys["custom_keys"]["total"] = $key_count;
+ $custom_keys["custom_keys"]["exists"] = $exists_count;
+ $custom_keys["custom_keys"]["custom"] = $custom_count;
+ } else {
+ $custom_keys["custom_keys"]["total"] = 0;
+ $custom_keys["custom_keys"]["exists"] = 0;
+ $custom_keys["custom_keys"]["custom"] = 0;
+ }
+
+ // Plugin translations
+ foreach($plugins as $plugin){
+
+ $title = $plugin->title;
+
+ $CONFIG->translations = array();
+ $plugin_language = $plugin->getPath() . DIRECTORY_SEPARATOR. "languages" . DIRECTORY_SEPARATOR . "en.php";
+
+ if(file_exists($plugin_language)){
+
+ include($plugin_language);
+
+ unset($CONFIG->translations["en"][""]);
+
+ $plugin_keys = $CONFIG->translations["en"];
+
+ $key_count = count($plugin_keys);
+
+ if(array_key_exists($current_language, $backup_full)){
+ $exists_count = $key_count - count(array_diff_key($plugin_keys, $backup_full[$current_language]));
+ } else {
+ $exists_count = 0;
+ }
+
+ if($custom_content = translation_editor_read_translation($current_language, $title)){
+ $custom_count = count($custom_content);
+ } else {
+ $custom_count = 0;
+ }
+
+ $plugins_result[$title]["total"] = $key_count;
+ $plugins_result[$title]["exists"] = $exists_count;
+ $plugins_result[$title]["custom"] = $custom_count;
+ }
+ }
+
+ ksort($plugins_result);
+
+ $result = $core + $custom_keys + $plugins_result;
+
+ $CONFIG->translations = $backup_full;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns translation data for a specific plugin
+ *
+ * @param string $current_language
+ * @param string $plugin
+ *
+ * @return array || false
+ */
+ function translation_editor_get_plugin($current_language, $plugin){
+ global $CONFIG;
+
+ $result = false;
+
+ if(!empty($current_language) && !empty($plugin)){
+
+ translation_editor_reload_all_translations();
+ translation_editor_load_translations($current_language);
+
+ $result = array();
+ $result["total"] = 0;
+
+ $backup_full = $CONFIG->translations;
+
+ $CONFIG->translations = array();
+ $base_path = $CONFIG->path;
+
+ if($plugin == "core"){
+ // Core translation
+ $plugin_language = $base_path . "languages" . DIRECTORY_SEPARATOR . "en.php";
+ } elseif($plugin == "custom_keys"){
+ $plugin_language = $CONFIG->dataroot . "translation_editor" . DIRECTORY_SEPARATOR . "custom_keys" . DIRECTORY_SEPARATOR . "en.php";
+ } else {
+ // Plugin translations
+ $plugin_language = $base_path . "mod" . DIRECTORY_SEPARATOR . $plugin . DIRECTORY_SEPARATOR. "languages" . DIRECTORY_SEPARATOR . "en.php";
+ }
+
+ // Fetch translations
+ if(file_exists($plugin_language)){
+ include($plugin_language);
+
+ unset($CONFIG->translations["en"][""]);
+
+ $plugin_keys = $CONFIG->translations["en"];
+
+ $key_count = count($plugin_keys);
+
+ if(array_key_exists($current_language, $backup_full)){
+ $exists_count = $key_count - count(array_diff_key($plugin_keys, $backup_full[$current_language]));
+ } else {
+ $exists_count = 0;
+ }
+
+ if($custom_content = translation_editor_read_translation($current_language, $plugin)){
+ $custom = $custom_content;
+ } else {
+ $custom = array();
+ }
+
+ $result["total"] = $key_count;
+ $result["exists"] = $exists_count;
+ $result["en"] = $plugin_keys;
+ $result["current_language"] = array_intersect_key($backup_full[$current_language], $plugin_keys);
+ $result["custom"] = $custom;
+ }
+
+ $CONFIG->translations = $backup_full;
+ }
+
+ return $result;
+ }
+
+ function translation_editor_compare_translations($current_language, $translated){
+ global $CONFIG;
+
+ $result = false;
+
+ if(!empty($current_language) && !empty($translated)){
+ $result = array();
+
+ $backup_full = $CONFIG->translations;
+
+ $CONFIG->translations = array();
+ translation_editor_reload_all_translations();
+
+ foreach($translated as $key => $value){
+ $original = clean_line_breaks(trim(html_entity_decode($CONFIG->translations[$current_language][$key], ENT_NOQUOTES, "UTF-8")));
+ $new = clean_line_breaks(trim(html_entity_decode($value, ENT_NOQUOTES, "UTF-8")));
+
+ if($original != $new && strlen($new) > 0){
+ $result[$key] = $new;
+ }
+ }
+
+ $CONFIG->translations = $backup_full;
+ }
+
+ return $result;
+ }
+
+ function clean_line_breaks($string){
+ return preg_replace("/(\r\n)|(\n|\r)/", PHP_EOL, $string);
+ }
+
+
+ function translation_editor_write_translation($current_language, $plugin, $translation){
+ global $CONFIG;
+
+ $result = false;
+
+ if(!empty($current_language) && !empty($plugin) && !empty($translation)){
+ translation_editor_check_file_structure($current_language);
+
+ $base_dir = $CONFIG->dataroot . "translation_editor" . DIRECTORY_SEPARATOR;
+ $contents = json_encode($translation);
+
+ if($bytes = file_put_contents($base_dir . $current_language . DIRECTORY_SEPARATOR . $plugin . ".json", $contents)){
+ $result = $bytes;
+ }
+ }
+
+ return $result;
+ }
+
+ function translation_editor_read_translation($current_language, $plugin){
+ $result = false;
+
+ if(!empty($current_language) && !empty($plugin)){
+ $base_dir = elgg_get_data_path() . "translation_editor" . DIRECTORY_SEPARATOR;
+
+ if(file_exists($base_dir . $current_language . DIRECTORY_SEPARATOR . $plugin . ".json")){
+ if($contents = file_get_contents($base_dir . $current_language . DIRECTORY_SEPARATOR . $plugin . ".json")){
+ $result = json_decode($contents, true);
+ }
+
+ }
+ }
+
+ return $result;
+ }
+
+ function translation_editor_load_translations($current_language = ""){
+ global $CONFIG;
+
+ if(empty($current_language)){
+ $current_language = get_current_language();
+ }
+
+ // check if update is needed
+ $main_ts = datalist_get("te_last_update_" . $current_language);
+ $site_ts = get_private_setting($CONFIG->site_guid, "te_last_update_" . $current_language);
+
+ if(!empty($main_ts)){
+ if(empty($site_ts) || ($main_ts > $site_ts)){
+ if(translation_editor_merge_translations($current_language)){
+ set_private_setting($CONFIG->site_guid, "te_last_update_" . $current_language, time());
+ }
+ }
+ } else {
+ translation_editor_merge_translations($current_language, true);
+ }
+
+ // load translations
+ if($translations = translation_editor_read_translation($current_language, "translation_editor_merged_" . $CONFIG->site_guid)){
+ add_translation($current_language, $translations);
+ }
+ }
+
+ function translation_editor_load_custom_languages(){
+ if($custom_languages = elgg_get_plugin_setting("custom_languages", "translation_editor")){
+ $custom_languages = explode(",", $custom_languages);
+
+ foreach($custom_languages as $lang){
+ add_translation($lang, array("" => ""));
+ }
+ }
+ }
+
+ function translation_editor_reload_all_translations(){
+ global $CONFIG;
+
+ static $run_once;
+
+ if(isset($run_once)){
+ $CONFIG->translations = $run_once;
+ } else {
+
+ foreach($CONFIG->language_paths as $path => $dummy){
+ if($handle = opendir($path)){
+ while($language = readdir($handle)){
+ if(is_file($path . $language)){
+ include($path . $language);
+ }
+ }
+
+ closedir($handle);
+ }
+ }
+
+ $run_once = $CONFIG->translations;
+ }
+ }
+
+ function translation_editor_check_file_structure($current_language){
+ $result = false;
+
+ if(!empty($current_language)){
+ $base_dir = elgg_get_data_path() . "translation_editor" . DIRECTORY_SEPARATOR;
+ if(!file_exists($base_dir)){
+ mkdir($base_dir);
+ }
+
+ if(!file_exists($base_dir . $current_language . DIRECTORY_SEPARATOR)){
+ mkdir($base_dir . $current_language . DIRECTORY_SEPARATOR);
+ }
+
+ $result = true;
+ }
+
+ return $result;
+ }
+
+ function translation_editor_delete_translation($current_language, $plugin){
+ $result = false;
+
+ if(!empty($current_language) && !empty($plugin)){
+ $filename = elgg_get_data_path() . "translation_editor" . DIRECTORY_SEPARATOR . $current_language . DIRECTORY_SEPARATOR . $plugin . ".json";
+
+ if(file_exists($filename)){
+ $result = unlink($filename);
+ }
+ }
+
+ return $result;
+ }
+
+ function translation_editor_get_language_completeness($current_language){
+ $result = false;
+
+ if(!empty($current_language) && $current_language != "en"){
+ $plugins = translation_editor_get_plugins($current_language);
+
+ $english_count = 0;
+ $current_count = 0;
+
+ foreach($plugins as $plugin){
+ $english_count += $plugin["total"];
+ $current_count += $plugin["exists"];
+ }
+
+ $result = round(($current_count / $english_count) * 100, 2);
+ }
+
+ return $result;
+ }
+
+ function translation_editor_is_translation_editor($user_guid = 0){
+ static $editors_cache;
+
+ $result = false;
+
+ if(empty($user_guid)){
+ $user_guid = elgg_get_logged_in_user_guid();
+ }
+
+ if(!empty($user_guid)){
+ // preload all editors
+ if(!isset($editors_cache)){
+ $editors_cache = array();
+
+ $options = array(
+ "type" => "user",
+ "limit" => false,
+ "metadata_name_value_pairs" => array(
+ "name" => "translation_editor",
+ "value" => true
+ ),
+ "callback" => "translation_editor_guid_only"
+ );
+
+ if($guids = elgg_get_entities_from_metadata($options)){
+ $editors_cache = $guids;
+ }
+ }
+
+ // is the user an editor or an admin
+ if(in_array($user_guid, $editors_cache)){
+ $result = true;
+ } elseif(($user = get_user($user_guid)) && $user->isAdmin()){
+ $result = true;
+ } elseif (elgg_get_plugin_setting('everybody_translate', 'translation_editor') == 'yes') {
+ $result = true;
+ }
+ }
+
+ return $result;
+ }
+
+ function translation_editor_unregister_translations(){
+ global $CONFIG;
+
+ $result = false;
+
+ if($disabled_languages = translation_editor_get_disabled_languages()){
+ foreach($CONFIG->translations as $key => $dummy){
+ if(in_array($key, $disabled_languages)){
+ unset($CONFIG->translations[$key]);
+ }
+ }
+
+ $result = true;
+ }
+
+ return $result;
+ }
+
+ function translation_editor_search_translation($query, $language = "en"){
+ $result = false;
+
+ $plugins = translation_editor_get_plugins($language);
+ $found = array();
+
+ foreach($plugins as $plugin => $data){
+ if($translations = translation_editor_get_plugin($language, $plugin)){
+ foreach($translations["en"] as $key => $value){
+ if(stristr($key, $query) || stristr($value, $query) || (array_key_exists($key, $translations["current_language"]) && stristr($translations["current_language"][$key], $query))){
+ if(!array_key_exists($plugin, $found)){
+ $found[$plugin] = array(
+ "en" => array(),
+ "current_language" => array()
+ );
+ }
+
+ $found[$plugin]["en"][$key] = $value;
+ if(array_key_exists($key, $translations["current_language"])){
+ $found[$plugin]["current_language"][$key] = $translations["current_language"][$key];
+ }
+ }
+ }
+
+ if(!empty($found)){
+ $result = $found;
+ }
+ }
+ }
+
+ return $result;
+ }
+
+ function translation_editor_merge_translations($language = "", $update = false){
+ global $CONFIG;
+
+ $result = false;
+
+ if(empty($language)){
+ $language = get_current_language();
+ }
+
+ if(!empty($language)){
+ $translations = array();
+
+ if($core = translation_editor_read_translation($language, "core")){
+ $translations = $core;
+ }
+
+ if($custom_keys = translation_editor_read_translation($language, "custom_keys")){
+ $translations += $custom_keys;
+ }
+
+ if($plugins = elgg_get_plugins()){
+ foreach($plugins as $plugin){
+ if($plugin_translation = translation_editor_read_translation($language, $plugin->title)){
+ $translations += $plugin_translation;
+ }
+ }
+ }
+
+ if(!empty($translations)){
+ if(translation_editor_write_translation($language, "translation_editor_merged_" . $CONFIG->site_guid, $translations)){
+ $result = true;
+ }
+ } else {
+ if(translation_editor_delete_translation($language, "translation_editor_merged_" . $CONFIG->site_guid)){
+ $result = true;
+ }
+ }
+ }
+
+ if($result){
+ elgg_trigger_event("language:merge", "translation_editor", $language);
+ }
+
+ // reset language cache on all sites
+ if($update){
+ $ts = time();
+
+ datalist_set("te_last_update_" . $language, $ts);
+ set_private_setting($CONFIG->site_guid, "te_last_update_" . $language, $ts);
+ }
+
+ return $result;
+ }
+
+ /**
+ * parses a string meant for printf and returns an array of found parameters
+ *
+ * @param string $string
+ * @return array
+ */
+ function translation_editor_get_string_parameters($string, $count = true) {
+ $valid = '/%[-+]?(?:[ 0]|\'.)?a?\d*(?:\.\d*)?[%bcdeEufFgGosxX]/';
+
+ $result = array();
+
+ if(!empty($string)){
+ if(!$string = preg_replace('/^[^%]*/', '', $string)){
+ // no results
+ } elseif(preg_match_all($valid, $string, $matches)) {
+ $result = $matches[0];
+ }
+ }
+
+ if($count){
+ $result = count($result);
+ }
+
+ return $result;
+ }
+
+ function translation_editor_get_disabled_languages(){
+ static $result;
+
+ if(!isset($result)){
+ $result = false;
+
+ if($disabled_languages = elgg_get_plugin_setting(TRANSLATION_EDITOR_DISABLED_LANGUAGE, "translation_editor")){
+ $result = string_to_tag_array($disabled_languages);
+ }
+ }
+
+ return $result;
+ }
+
+ function translation_editor_guid_only($row){
+ return (int) $row->guid;
+ }
diff --git a/mod/translation_editor/lib/hooks.php b/mod/translation_editor/lib/hooks.php
new file mode 100644
index 000000000..486fb0b7a
--- /dev/null
+++ b/mod/translation_editor/lib/hooks.php
@@ -0,0 +1,45 @@
+<?php
+
+ function translation_editor_user_hover_menu($hook, $type, $return, $params) {
+ $user = $params['entity'];
+
+ if (elgg_is_admin_logged_in() && !($user->isAdmin())){
+ // TODO: replace with a single toggle editor action?
+ if(translation_editor_is_translation_editor($user->getGUID())){
+ $url = "action/translation_editor/unmake_translation_editor?user=" . $user->getGUID();
+ $title = elgg_echo("translation_editor:action:unmake_translation_editor");
+ } else {
+ $url = "action/translation_editor/make_translation_editor?user=" . $user->getGUID();
+ $title = elgg_echo("translation_editor:action:make_translation_editor");
+ }
+
+ $item = new ElggMenuItem('translation_editor', $title, $url);
+ $item->setSection('admin');
+ $item->setConfirmText(elgg_echo("question:areyousure"));
+ $return[] = $item;
+
+ return $return;
+ }
+ }
+
+ function translation_editor_actions_hook($hook, $type, $return, $params){
+ $allowed_actions = array(
+ "admin/plugins/activate",
+ "admin/plugins/deactivate",
+ "admin/plugins/activate_all",
+ "admin/plugins/deactivate_all",
+ "admin/plugins/set_priority",
+ "upgrading" // not actualy an action but comes from events.php
+ );
+
+ if(!empty($type) && in_array($type, $allowed_actions)){
+ // make sure we have all translations
+ translation_editor_reload_all_translations();
+
+ if($languages = get_installed_translations()){
+ foreach($languages as $key => $desc){
+ remove_private_setting(elgg_get_site_entity()->getGUID(), "te_last_update_" . $key);
+ }
+ }
+ }
+ } \ No newline at end of file
diff --git a/mod/translation_editor/manifest.xml b/mod/translation_editor/manifest.xml
new file mode 100644
index 000000000..7e1952d8c
--- /dev/null
+++ b/mod/translation_editor/manifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>Translation Editor</name>
+ <author>ColdTrick IT Solutions</author>
+ <version>1.2.1</version>
+ <description>Translation Editor provides an easy way to edit translations.</description>
+ <website>http://www.coldtrick.com/</website>
+ <copyright>(C) ColdTrick IT Solutions 2009 - 2011</copyright>
+ <license>GNU Public License version 2</license>
+
+ <requires>
+ <type>elgg_version</type>
+ <version>2011061200</version>
+ </requires>
+
+ <category>ColdTrick</category>
+</plugin_manifest> \ No newline at end of file
diff --git a/mod/translation_editor/pages/index.php b/mod/translation_editor/pages/index.php
new file mode 100644
index 000000000..92280460a
--- /dev/null
+++ b/mod/translation_editor/pages/index.php
@@ -0,0 +1,64 @@
+<?php
+
+ global $CONFIG;
+
+ gatekeeper();
+
+ // Build elements
+ $title_text = elgg_echo("translation_editor:menu:title");
+
+ elgg_push_breadcrumb($title_text, "translation_editor");
+
+ // Get inputs
+ $current_language = get_input("current_language", get_current_language());
+
+ $translations = get_installed_translations();
+
+ if(!(array_key_exists($current_language,$translations ))){
+ forward("translation_editor");
+ }
+
+ $plugin = get_input("plugin");
+
+ $languages = array_keys($CONFIG->translations);
+
+ if(!($disabled_languages = translation_editor_get_disabled_languages())){
+ $disabled_languages = array();
+ }
+
+ if(!empty($CONFIG->language)){
+ $site_language = $CONFIG->language;
+ } else {
+ $site_language = "en";
+ }
+
+ $body .= elgg_view("translation_editor/language_selector", array("current_language" => $current_language, "plugin" => $plugin, "languages" => $languages, "disabled_languages" => $disabled_languages, "site_language" => $site_language));
+
+ if(empty($plugin)){
+ // show plugin list
+ elgg_push_breadcrumb(elgg_echo($current_language));
+
+ $plugins = translation_editor_get_plugins($current_language);
+
+ $body .= elgg_view("translation_editor/search", array("current_language" => $current_language, "query" => get_input("q")));
+ $body .= elgg_view("translation_editor/plugin_list", array("plugins" => $plugins, "current_language" => $current_language));
+ } else {
+ // show plugin keys
+ elgg_push_breadcrumb(elgg_echo($current_language), "translation_editor/" . $current_language);
+ elgg_push_breadcrumb($plugin);
+
+ $translation = translation_editor_get_plugin($current_language, $plugin);
+ if($plugin == "custom_keys" && elgg_is_admin_logged_in()){
+ $body .= elgg_view("translation_editor/add_custom_key");
+ }
+ $body .= elgg_view("translation_editor/plugin_edit", array("plugin" => $plugin, "current_language" => $current_language, "translation" => $translation));
+ }
+
+ // Build page
+ $page_data = elgg_view_layout('one_column', array(
+ 'title' => $title_text,
+ 'content' => $body
+ ));
+
+ echo elgg_view_page($title_text, $page_data);
+ \ No newline at end of file
diff --git a/mod/translation_editor/pages/search.php b/mod/translation_editor/pages/search.php
new file mode 100644
index 000000000..978b55704
--- /dev/null
+++ b/mod/translation_editor/pages/search.php
@@ -0,0 +1,32 @@
+<?php
+
+ gatekeeper();
+
+ // get inputs
+ $q = get_input("translation_editor_search");
+ $language = get_input("language", "en");
+
+ $found = translation_editor_search_translation($q, $language);
+ $trans = get_installed_translations();
+
+ if(!array_key_exists($language, $trans)){
+ forward("translation_editor");
+ }
+
+ // build page elements
+ $title_text = elgg_echo("translation_editor:search");
+ $title = elgg_view_title($title_text);
+
+ elgg_push_breadcrumb(elgg_echo("translation_editor:menu:title"), "translation_editor");
+ elgg_push_breadcrumb(elgg_echo($language), "translation_editor/" . $language);
+ elgg_push_breadcrumb($title_text);
+
+ $body .= elgg_view("translation_editor/search", array("current_language" => $language, "query" => $q));
+ $body .= elgg_view("translation_editor/search_results", array("results" => $found, "current_language" => $language));
+
+ // Build page
+ $page_data = elgg_view_layout('one_column', array(
+ 'content' => "<div class='elgg-head'>" . $title . "</div>" . $body
+ ));
+
+ echo elgg_view_page($title_text, $page_data);
diff --git a/mod/translation_editor/start.php b/mod/translation_editor/start.php
new file mode 100644
index 000000000..a85a214c8
--- /dev/null
+++ b/mod/translation_editor/start.php
@@ -0,0 +1,139 @@
+<?php
+
+ define("TRANSLATION_EDITOR_DISABLED_LANGUAGE", "disabled_languages");
+
+ require_once(dirname(__FILE__) . "/lib/functions.php");
+ require_once(dirname(__FILE__) . "/lib/hooks.php");
+ require_once(dirname(__FILE__) . "/lib/events.php");
+
+ function translation_editor_init(){
+ global $CONFIG;
+
+ elgg_extend_view("css/elgg", "translation_editor/css/site");
+ elgg_extend_view("js/elgg", "translation_editor/js/site");
+
+ elgg_register_page_handler('translation_editor', 'translation_editor_page_handler');
+
+ // add to site menu
+ if(translation_editor_is_translation_editor(elgg_get_logged_in_user_guid())){
+ $menu_item = new ElggMenuItem("translation_editor", elgg_echo('translation_editor:menu:title'), "translation_editor");
+ elgg_register_menu_item("site", $menu_item);
+ }
+
+ if (elgg_is_admin_logged_in()){
+ // add to admin menu
+ elgg_register_menu_item('page', array(
+ 'name' => "translation_editor",
+ 'href' => "translation_editor",
+ 'text' => elgg_echo("translation_editor:menu:title"),
+ 'context' => "admin",
+ 'parent_name' => "appearance",
+ 'section' => "configure"
+ ));
+ }
+
+ elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'translation_editor_user_hover_menu');
+
+ }
+
+ function translation_editor_page_handler($page){
+
+ switch($page[0]){
+ case "search":
+ $q = get_input("translation_editor_search");
+ if(!empty($q)){
+ include(dirname(__FILE__) . "/pages/search.php");
+ break;
+ }
+ default:
+ if(!empty($page[0])){
+ set_input("current_language", $page[0]);
+ if(!empty($page[1])){
+ set_input("plugin", $page[1]);
+ }
+
+ include(dirname(__FILE__) . "/pages/index.php");
+ } else {
+ $current_language = get_current_language();
+ forward("translation_editor/" . $current_language);
+ }
+ break;
+ }
+
+ return true;
+ }
+
+ function translation_editor_plugins_boot_event(){
+ global $CONFIG;
+
+ run_function_once("translation_editor_version_053");
+
+ // add the custom_keys_locations to language paths
+ $custom_keys_path = $CONFIG->dataroot . "translation_editor" . DIRECTORY_SEPARATOR . "custom_keys" . DIRECTORY_SEPARATOR;
+ if(is_dir($custom_keys_path)){
+ $CONFIG->language_paths[$custom_keys_path] = true;
+ }
+
+ // force creation of static to prevent reload of unwanted translations
+ reload_all_translations();
+
+ translation_editor_load_custom_languages();
+
+ if(elgg_get_context() != "translation_editor"){
+ // remove disabled languages
+ translation_editor_unregister_translations();
+ }
+
+ // load custom translations
+ $user_language = get_current_language();
+ $elgg_default_language = "en";
+
+ $load_languages = array($user_language, $elgg_default_language);
+ $load_languages = array_unique($load_languages);
+
+ $disabled_languages = translation_editor_get_disabled_languages();
+
+ foreach($load_languages as $language){
+ if(empty($disabled_languages) || !in_array($language, $disabled_languages)){
+ // add custom translations
+ translation_editor_load_translations($language);
+ }
+ }
+ }
+
+ function translation_editor_version_053(){
+ if($languages = get_installed_translations()){
+ foreach($languages as $lang => $name){
+ translation_editor_merge_translations($lang);
+ }
+ }
+ }
+
+ // Plugin init
+ elgg_register_event_handler('plugins_boot', 'system', 'translation_editor_plugins_boot_event', 50); // before normal execution to prevent conflicts with plugins like language_selector
+ elgg_register_event_handler('init', 'system', 'translation_editor_init');
+
+ // register hooks
+ elgg_register_plugin_hook_handler("action", "admin/plugins/activate", "translation_editor_actions_hook");
+ elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate", "translation_editor_actions_hook");
+ elgg_register_plugin_hook_handler("action", "admin/plugins/activate_all", "translation_editor_actions_hook");
+ elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate_all", "translation_editor_actions_hook");
+ elgg_register_plugin_hook_handler("action", "admin/plugins/set_priority", "translation_editor_actions_hook");
+
+ // register events
+ elgg_register_event_handler("upgrade", "system", "translation_editor_upgrade_event");
+
+ // Register actions
+ elgg_register_action("translation_editor/translate", dirname(__FILE__) . "/actions/translate.php");
+ elgg_register_action("translation_editor/translate_search", dirname(__FILE__) . "/actions/translate_search.php");
+ elgg_register_action("translation_editor/merge", dirname(__FILE__) . "/actions/merge.php");
+
+ // Admin only actions
+ elgg_register_action("translation_editor/make_translation_editor", dirname(__FILE__) . "/actions/make_translation_editor.php", "admin");
+ elgg_register_action("translation_editor/unmake_translation_editor", dirname(__FILE__) . "/actions/unmake_translation_editor.php", "admin");
+ elgg_register_action("translation_editor/delete", dirname(__FILE__) . "/actions/delete.php", "admin");
+ elgg_register_action("translation_editor/disable_languages", dirname(__FILE__) . "/actions/disable_languages.php", "admin");
+ elgg_register_action("translation_editor/add_language", dirname(__FILE__) . "/actions/add_language.php", "admin");
+ elgg_register_action("translation_editor/add_custom_key", dirname(__FILE__) . "/actions/add_custom_key.php", "admin");
+ elgg_register_action("translation_editor/delete_language", dirname(__FILE__) . "/actions/delete_language.php", "admin");
+ \ No newline at end of file
diff --git a/mod/translation_editor/views/default/core/settings/account/language.php b/mod/translation_editor/views/default/core/settings/account/language.php
new file mode 100644
index 000000000..225bccc97
--- /dev/null
+++ b/mod/translation_editor/views/default/core/settings/account/language.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Provide a way of setting your language prefs
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+if ($user = elgg_get_page_owner_entity()) {
+ translation_editor_unregister_translations();
+
+ $translations = get_installed_translations();
+
+ $value = $CONFIG->language;
+ if (!empty($user->language)) {
+ $value = $user->language;
+ }
+
+ if(count($translations ) > 1){
+ ?>
+ <div class="elgg-module elgg-module-info">
+ <div class="elgg-head">
+ <h3><?php echo elgg_echo('user:set:language'); ?></h3>
+ </div>
+ <div class="elgg-body">
+ <p>
+ <?php echo elgg_echo('user:language:label'); ?>:
+ <?php
+ echo elgg_view("input/dropdown", array(
+ 'name' => 'language',
+ 'value' => $value,
+ 'options_values' => $translations
+ ));
+ ?>
+ </p>
+ </div>
+ </div>
+ <?php
+ } else {
+ echo elgg_view("input/hidden", array("name" => "language", "value" => $value));
+ }
+} \ No newline at end of file
diff --git a/mod/translation_editor/views/default/plugins/translation_editor/settings.php b/mod/translation_editor/views/default/plugins/translation_editor/settings.php
new file mode 100644
index 000000000..4dfe4b7c9
--- /dev/null
+++ b/mod/translation_editor/views/default/plugins/translation_editor/settings.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Translation Editor plugin settings
+ */
+
+$everybody_translate_string = elgg_echo('translation_editor:settings:everybody_translate');
+$everybody_translate_view = elgg_view('input/dropdown', array(
+ 'name' => 'params[everybody_translate]',
+ 'options_values' => array(
+ 'yes' => elgg_echo('option:yes'),
+ 'no' => elgg_echo('option:no'),
+ ),
+ 'value' => $vars['entity']->everybody_translate ? $vars['entity']->everybody_translate : 'no',
+));
+
+$settings = <<<__HTML
+<div>$everybody_translate_string $everybody_translate_view</div>
+__HTML;
+
+echo $settings;
diff --git a/mod/translation_editor/views/default/translation_editor/add_custom_key.php b/mod/translation_editor/views/default/translation_editor/add_custom_key.php
new file mode 100644
index 000000000..4726479cc
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/add_custom_key.php
@@ -0,0 +1,21 @@
+<?php
+
+ $action = $vars["url"] . "action/translation_editor/add_custom_key";
+
+ $form_body .= "<div>";
+ $form_body .= "<label>" . elgg_echo("translation_editor:custom_keys:key") . "</label>";
+ $form_body .= elgg_view("input/text", array("name" => "key"));
+
+ $form_body .= "<label>" . elgg_echo("translation_editor:custom_keys:translation") . "</label>";
+ $form_body .= "<textarea name='translation'></textarea>";
+ $form_body .= "<span id='translation_editor_custom_keys_translation_info'>" . elgg_echo("translation_editor:custom_keys:translation_info") . "</span>";
+ $form_body .= "</div>";
+
+ $form_body .= elgg_view("input/submit", array("value" => elgg_echo("save")));
+
+ $form = elgg_view("input/form", array("body" => $form_body, "action" => $action, "id" => "translation_editor_custom_keys_form"));
+
+?>
+<h3><?php echo elgg_echo("translation_editor:custom_keys:title"); ?></h3>
+<?php
+ echo $form; \ No newline at end of file
diff --git a/mod/translation_editor/views/default/translation_editor/add_language.php b/mod/translation_editor/views/default/translation_editor/add_language.php
new file mode 100644
index 000000000..4d4ba5dbf
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/add_language.php
@@ -0,0 +1,167 @@
+<?php
+
+/**
+ * Languages according to ISO 639-1
+ */
+
+ $options = array(
+
+ "aa" => "Afar",
+ "ab" => "Abkhazian",
+ "af" => "Afrikaans",
+ "am" => "Amharic",
+ "ar" => "Arabic",
+ "as" => "Assamese",
+ "ay" => "Aymara",
+ "az" => "Azerbaijani",
+ "ba" => "Bashkir",
+ "be" => "Byelorussian",
+ "bg" => "Bulgarian",
+ "bh" => "Bihari",
+ "bi" => "Bislama",
+ "bn" => "Bengali; Bangla",
+ "bo" => "Tibetan",
+ "br" => "Breton",
+ "ca" => "Catalan",
+ "co" => "Corsican",
+ "cs" => "Czech",
+ "cy" => "Welsh",
+ "da" => "Danish",
+ "de" => "German",
+ "dz" => "Bhutani",
+ "el" => "Greek",
+ "en" => "English",
+ "eo" => "Esperanto",
+ "es" => "Spanish",
+ "et" => "Estonian",
+ "eu" => "Basque",
+ "fa" => "Persian",
+ "fi" => "Finnish",
+ "fj" => "Fiji",
+ "fo" => "Faeroese",
+ "fr" => "French",
+ "fy" => "Frisian",
+ "ga" => "Irish",
+ "gd" => "Scots / Gaelic",
+ "gl" => "Galician",
+ "gn" => "Guarani",
+ "gu" => "Gujarati",
+ "he" => "Hebrew",
+ "ha" => "Hausa",
+ "hi" => "Hindi",
+ "hr" => "Croatian",
+ "hu" => "Hungarian",
+ "hy" => "Armenian",
+ "ia" => "Interlingua",
+ "id" => "Indonesian",
+ "ie" => "Interlingue",
+ "ik" => "Inupiak",
+ "is" => "Icelandic",
+ "it" => "Italian",
+ "iu" => "Inuktitut",
+ "iw" => "Hebrew (obsolete)",
+ "ja" => "Japanese",
+ "ji" => "Yiddish (obsolete)",
+ "jw" => "Javanese",
+ "ka" => "Georgian",
+ "kk" => "Kazakh",
+ "kl" => "Greenlandic",
+ "km" => "Cambodian",
+ "kn" => "Kannada",
+ "ko" => "Korean",
+ "ks" => "Kashmiri",
+ "ku" => "Kurdish",
+ "ky" => "Kirghiz",
+ "la" => "Latin",
+ "ln" => "Lingala",
+ "lo" => "Laothian",
+ "lt" => "Lithuanian",
+ "lv" => "Latvian/Lettish",
+ "mg" => "Malagasy",
+ "mi" => "Maori",
+ "mk" => "Macedonian",
+ "ml" => "Malayalam",
+ "mn" => "Mongolian",
+ "mo" => "Moldavian",
+ "mr" => "Marathi",
+ "ms" => "Malay",
+ "mt" => "Maltese",
+ "my" => "Burmese",
+ "na" => "Nauru",
+ "ne" => "Nepali",
+ "nl" => "Dutch",
+ "no" => "Norwegian",
+ "oc" => "Occitan",
+ "om" => "(Afan) Oromo",
+ "or" => "Oriya",
+ "pa" => "Punjabi",
+ "pl" => "Polish",
+ "ps" => "Pashto / Pushto",
+ "pt" => "Portuguese",
+ "qu" => "Quechua",
+ "rm" => "Rhaeto-Romance",
+ "rn" => "Kirundi",
+ "ro" => "Romanian",
+ "ru" => "Russian",
+ "rw" => "Kinyarwanda",
+ "sa" => "Sanskrit",
+ "sd" => "Sindhi",
+ "sg" => "Sangro",
+ "sh" => "Serbo-Croatian",
+ "si" => "Singhalese",
+ "sk" => "Slovak",
+ "sl" => "Slovenian",
+ "sm" => "Samoan",
+ "sn" => "Shona",
+ "so" => "Somali",
+ "sq" => "Albanian",
+ "sr" => "Serbian",
+ "ss" => "Siswati",
+ "st" => "Sesotho",
+ "su" => "Sundanese",
+ "sv" => "Swedish",
+ "sw" => "Swahili",
+ "ta" => "Tamil",
+ "te" => "Tegulu",
+ "tg" => "Tajik",
+ "th" => "Thai",
+ "ti" => "Tigrinya",
+ "tk" => "Turkmen",
+ "tl" => "Tagalog",
+ "tn" => "Setswana",
+ "to" => "Tonga",
+ "tr" => "Turkish",
+ "ts" => "Tsonga",
+ "tt" => "Tatar",
+ "tw" => "Twi",
+ "ug" => "Uigur",
+ "uk" => "Ukrainian",
+ "ur" => "Urdu",
+ "uz" => "Uzbek",
+ "vi" => "Vietnamese",
+ "vo" => "Volapuk",
+ "wo" => "Wolof",
+ "xh" => "Xhosa",
+ "yi" => "Yiddish",
+ "yo" => "Yoruba",
+ "za" => "Zuang",
+ "zh" => "Chinese",
+ "zu" => "Zulu"
+ );
+
+ foreach(get_installed_translations() as $index => $lang){
+ unset($options[$index]);
+ }
+
+ asort($options);
+
+ $form_body .= elgg_view("input/dropdown", array("options_values" => $options, "name" => "code"));
+ $form_body .= " ";
+ $form_body .= elgg_view("input/submit", array("value" => elgg_echo("save")));
+
+ $form = elgg_view("input/form", array("body" => $form_body, "action" => $vars["url"] . "action/translation_editor/add_language", "id" => "translation_editor_add_language_form", "class" => "hidden"));
+
+ echo "<div>";
+ echo "<a href='javascript:void(0);' onclick='$(\"#translation_editor_add_language_form\").toggle();'><b>+</b> " . elgg_echo("translation_editor:language_selector:add_language") . "</a>";
+ echo $form;
+ echo "</div>";
diff --git a/mod/translation_editor/views/default/translation_editor/css/site.php b/mod/translation_editor/views/default/translation_editor/css/site.php
new file mode 100644
index 000000000..941ccdb7a
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/css/site.php
@@ -0,0 +1,99 @@
+<?php
+ $graphics_folder = $vars["url"] . "mod/translation_editor/_graphics/";
+?>
+
+#translation_editor_language_table th,
+#translation_editor_plugin_list th {
+ font-weight: bold;
+}
+
+#translation_editor_language_table .translation_editor_flag,
+#translation_editor_language_table .translation_editor_enable {
+ width: 1%;
+ text-align: center;
+}
+
+#translation_editor_plugin_list th,
+#translation_editor_plugin_list td {
+ text-align: center;
+ white-space: nowrap;
+}
+
+#translation_editor_plugin_list .first_col {
+ text-align: left;
+ width: 100%;
+}
+
+#translation_editor_site_language {
+ color: gray;
+ margin-left: 10px;
+}
+
+#translation_editor_custom_keys_translation_info {
+ color: gray;
+}
+
+.translation_editor_translation_complete {
+ color: green;
+}
+
+.translation_editor_translation_needed {
+ color: red;
+}
+
+.translation_editor_translation_table textarea {
+ height: 70px;
+}
+
+.view_mode_active {
+ font-weight: bold;
+}
+
+.translation_editor_translation_table tr{
+ display: none;
+}
+
+.translation_editor_translation_table tr.first_row th{
+ font-weight: bold;
+}
+
+.translation_editor_translation_table tr.first_row th span{
+ font-weight: normal;
+}
+
+.translation_editor_translation_table tr.first_row,
+.translation_editor_translation_table tr[rel='missing']{
+ display: table-row;
+ <!--
+ display: inline-block;
+ -->
+}
+
+.translation_editor_plugin_key {
+ float: right;
+ width: 16px;
+ height: 16px;
+ background: url(<?php echo $graphics_folder;?>key.gif) no-repeat;
+}
+
+.translation_editor_translation_table {
+ margin-bottom: 20px;
+}
+
+.translation_editor_translation_table pre {
+ white-space: normal;
+ margin-bottom: 5px;
+}
+
+.translation_editor_translation_table td{
+ white-space: nowrap;
+}
+
+.translation_editor_translation_table .first_col {
+ width: 33px;
+}
+
+#translation_editor_search_form td {
+ width: 100%;
+ white-space: nowrap;
+}
diff --git a/mod/translation_editor/views/default/translation_editor/js/site.php b/mod/translation_editor/views/default/translation_editor/js/site.php
new file mode 100644
index 000000000..be4dc0266
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/js/site.php
@@ -0,0 +1,41 @@
+<?php
+
+?>
+//<script>
+function translation_editor_disable_language(){
+ var url = elgg.security.addToken("<?php echo $vars["url"]; ?>action/translation_editor/disable_languages?");
+
+ var lan = new Array();
+ $('#translation_editor_language_table input[name="disabled_languages[]"]:checked').each(function(index, elm){
+ lan.push($(this).val());
+ });
+
+ $.post(url, {'disabled_languages[]': lan });
+}
+
+function toggleViewMode(mode){
+ $("#translation_editor_plugin_toggle a").removeClass("view_mode_active");
+ $("#view_mode_" + mode).addClass("view_mode_active");
+
+ if(mode == "all"){
+ $("#translation_editor_plugin_form tr").show();
+ } else {
+ $("#translation_editor_plugin_form tr").hide();
+ $("#translation_editor_plugin_form tr[rel='" + mode + "']").show();
+ $("#translation_editor_plugin_form tr:first").show();
+ }
+}
+
+function translationEditorJQuerySave(){
+ var url = $('#translation_editor_plugin_form').attr("action") + "?jquery=yes";
+ var formData = $('#translation_editor_plugin_form').serialize();
+
+ $.post(url, formData, function(data){}, "json");
+}
+
+function translationEditorJQuerySearchSave(){
+ var url = $('#translation_editor_search_result_form').attr("action") + "?jquery=yes";
+ var formData = $('#translation_editor_search_result_form').serialize();
+
+ $.post(url, formData, function(data){}, "json");
+} \ No newline at end of file
diff --git a/mod/translation_editor/views/default/translation_editor/language_selector.php b/mod/translation_editor/views/default/translation_editor/language_selector.php
new file mode 100644
index 000000000..89ebbf882
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/language_selector.php
@@ -0,0 +1,88 @@
+<?php
+
+ $languages = $vars["languages"];
+ $current_language = $vars["current_language"];
+ $plugin = $vars["plugin"];
+ $disabled_languages = $vars["disabled_languages"];
+ $site_language = $vars["site_language"];
+
+ if(!empty($languages)){
+ $list = "<table id='translation_editor_language_table' class='elgg-table' title='" . elgg_echo("translation_editor:language_selector:title") . "'>";
+ $list .= "<tr>";
+ $list .= "<th class='translation_editor_flag'>&nbsp;</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:language") . "</th>";
+ if(elgg_is_admin_logged_in()){
+ $list .= "<th class='translation_editor_enable'>" . elgg_echo("translation_editor:disabled") . "</th>";
+ }
+ $list .= "</tr>";
+
+ foreach($languages as $language){
+ $list .= "<tr>";
+
+ // flag
+ $lang_flag_file = "mod/translation_editor/_graphics/flags/" . $language . ".png";
+
+ if(file_exists(elgg_get_root_path() . $lang_flag_file)){
+ $list .= "<td class='translation_editor_flag'>";
+ $list .= "<img src='" . $vars['url'] . $lang_flag_file . "' alt='" . elgg_echo($language) . "' title='" . elgg_echo($language) . "'> ";
+ $list .= "</td>";
+ } else {
+ $list .= "<td class='translation_editor_flag'>&nbsp;</td>";
+ }
+
+ // language
+ $list .= "<td>";
+ if($language != $current_language){
+ $url = $vars["url"] . "translation_editor/" . $language . "/" . $plugin;
+
+ if($language != "en"){
+ $completeness = translation_editor_get_language_completeness($language);
+ $list .= "<a href='" . $url . "'>" . elgg_echo($language) . " (" . $completeness . "%)</a>";
+
+ if(elgg_is_admin_logged_in() && $completeness == 0){
+ $list .= elgg_view("output/confirmlink", array("href" => $vars["url"] . "action/translation_editor/delete_language?language=" . $language, "confirm" => elgg_echo("translation_editor:language_selector:remove_language:confirm"), "text" => elgg_view_icon("delete-alt")));
+ }
+ } else {
+ $list .= "<a href='" . $url . "'>" . elgg_echo($language) . "</a>";
+
+ }
+ } else {
+ if($language != "en"){
+ $list .= elgg_echo($language) . " (" . translation_editor_get_language_completeness($language) . "%)";
+ } else {
+ $list .= elgg_echo($language);
+ }
+ }
+
+ if($site_language == $language){
+ $list .= "<span id='translation_editor_site_language'>" . elgg_echo("translation_editor:language_selector:site_language") . "</span>";
+ }
+ $list .= "</td>";
+
+ // checkbox
+ if(elgg_is_admin_logged_in()){
+ $list .= "<td class='translation_editor_enable'>";
+ if($language != "en"){
+ $list .= "<input type='checkbox' name='disabled_languages[]' value='" . $language . "' onchange='translation_editor_disable_language();' ";
+ if(in_array($language, $disabled_languages)){
+ $list .= "checked='checked' ";
+ }
+ $list .= "/>";
+ }
+ $list .= "</td>";
+ }
+
+ $list .= "</tr>";
+ }
+
+ $list .= "</table>";
+
+ echo $list;
+ }
+
+ if(elgg_is_admin_logged_in()){
+ // add a new language
+ echo elgg_view("translation_editor/add_language");
+ }
+
+ echo "<br />";
diff --git a/mod/translation_editor/views/default/translation_editor/plugin_edit.php b/mod/translation_editor/views/default/translation_editor/plugin_edit.php
new file mode 100644
index 000000000..113813a2a
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/plugin_edit.php
@@ -0,0 +1,147 @@
+<?php
+ $current_language = $vars['current_language'];
+ $english = $vars['translation']['en'];
+ $translated_language = $vars['translation']['current_language'];
+ $custom = $vars['translation']['custom'];
+
+ $en_flag_file = "mod/translation_editor/_graphics/flags/en.png";
+
+ if(file_exists(elgg_get_root_path() . $en_flag_file)){
+ $en_flag = "<img src='" . $vars['url'] . $en_flag_file . "' alt='" . elgg_echo("en") . "' title='" . elgg_echo("en") . "'>";
+ } else {
+ $en_flag = "en";
+ }
+
+ $lang_flag_file = "mod/translation_editor/_graphics/flags/" . $current_language . ".png";
+
+ if(file_exists(elgg_get_root_path() . $lang_flag_file)){
+ $lang_flag = "<img src='" . $vars['url'] . $lang_flag_file . "' alt='" . elgg_echo($current_language) . "' title='" . elgg_echo($current_language) . "'>";
+ } else {
+ $lang_flag = $current_language;
+ }
+
+ $missing_count = 0;
+ $equal_count = 0;
+ $params_count = 0;
+ $custom_count = 0;
+
+ foreach($english as $en_key => $en_value){
+ $en_params = translation_editor_get_string_parameters($en_value);
+ $cur_params = translation_editor_get_string_parameters($translated_language[$en_key]);
+
+ if(!array_key_exists($en_key, $translated_language)){
+ $row_rel = "rel='missing'";
+ $missing_count++;
+ } elseif($en_value == $translated_language[$en_key]){
+ $row_rel = "rel='equal'";
+ $equal_count++;
+ } elseif($en_params != $cur_params){
+ $row_rel = "rel='params'";
+ $params_count++;
+ } elseif(array_key_exists($en_key, $custom)){
+ $row_rel = "rel='custom'";
+ $custom_count++;
+ } else {
+ $row_rel = "";
+ }
+
+ // English information
+ $translation .= "<tr " . $row_rel . ">";
+ $translation .= "<td>" . $en_flag . "</td>";
+ $translation .= "<td>";
+ $translation .= "<span class='translation_editor_plugin_key' title='" . $en_key . "'></span>";
+ $translation .= "<pre class='translation_editor_pre'>" . nl2br(htmlspecialchars($en_value)) . "</pre>";
+ $translation .="</td>";
+ $translation .= "</tr>";
+
+ // Custom language information
+ $translation .= "<tr ". $row_rel . ">";
+ $translation .= "<td>" . $lang_flag . "</td>";
+ $translation .= "<td>";
+ $translation .= "<textarea name='translation[" . $en_key . "]' >";
+ $translation .= $translated_language[$en_key];
+ $translation .= "</textarea>";
+ $translation .= "</td>";
+ $translation .= "</tr>";
+ }
+
+ $selected_view_mode = "missing";
+
+ if($missing_count == 0){
+ $selected_view_mode = "all";
+ ?>
+ <style type="text/css">
+ .translation_editor_translation_table tr {
+ display: table-row;
+ <!--
+ display: inline-block;
+ -->
+ }
+ </style>
+ <?php
+ }
+
+ $toggle = "<span id='translation_editor_plugin_toggle' class='float-alt'>";
+
+ $toggle .= elgg_echo("translation_editor:plugin_edit:show") . " ";
+
+ $missing_class = "";
+ $equal_class = "";
+ $params_class = "";
+ $custom_class = "";
+ $all_class = "";
+
+ switch($selected_view_mode){
+ case "missing":
+ $missing_class = "view_mode_active";
+ break;
+ case "all":
+ $all_class = "view_mode_active";
+ break;
+ case "equal":
+ $equal_class = "view_mode_active";
+ break;
+ case "custom":
+ $custom_class = "view_mode_active";
+ break;
+ case "params":
+ $params_class = "view_mode_active";
+ break;
+ }
+
+ $toggle .= "<a class='$missing_class' id='view_mode_missing' href='javascript:toggleViewMode(\"missing\");'>" . elgg_echo("translation_editor:plugin_edit:show:missing") . "</a> (" . $missing_count . "), ";
+ $toggle .= "<a class='$equal_class' id='view_mode_equal' href='javascript:toggleViewMode(\"equal\");'>" . elgg_echo("translation_editor:plugin_edit:show:equal") . "</a> (" . $equal_count . "), ";
+ $toggle .= "<a class='$params_class' id='view_mode_params' href='javascript:toggleViewMode(\"params\");'>" . elgg_echo("translation_editor:plugin_edit:show:params") . "</a> (" . $params_count . "), ";
+ $toggle .= "<a class='$custom_class' id='view_mode_custom' href='javascript:toggleViewMode(\"custom\");'>" . elgg_echo("translation_editor:plugin_edit:show:custom") . "</a> (" . $custom_count . "), ";
+ $toggle .= "<a class='$all_class' id='view_mode_all' href='javascript:toggleViewMode(\"all\");'>" . elgg_echo("translation_editor:plugin_edit:show:all") . "</a> (" . $vars['translation']['total'] . ")";
+ $toggle .= "</span>";
+
+ $list .= "<table class='elgg-table translation_editor_translation_table'>";
+ $list .= "<col class='first_col'/>";
+ $list .= "<tr class='first_row'><th colspan='2'>";
+ $list .= $toggle;
+ $list .= elgg_echo("translation_editor:plugin_edit:title") . " " . $vars['plugin'];
+ $list .= "</th></tr>";
+ $list .= $translation;
+ $list .= "</table>";
+
+?>
+<script type="text/javascript">
+ $(document).ready(function(){
+ $('#translation_editor_plugin_form textarea').live("change", function(){
+ translationEditorJQuerySave();
+ });
+ });
+</script>
+
+<div>
+ <form id="translation_editor_plugin_form" action="<?php echo $vars['url'];?>action/translation_editor/translate" method="post">
+ <?php echo elgg_view("input/securitytoken"); ?>
+ <input type='hidden' name='current_language' value='<?php echo $current_language; ?>' />
+ <input type='hidden' name='plugin' value='<?php echo $vars['plugin']; ?>' />
+ <?php
+ echo $list;
+ echo elgg_view("input/submit", array("value" => elgg_echo("save")));
+ ?>
+ </form>
+</div>
diff --git a/mod/translation_editor/views/default/translation_editor/plugin_list.php b/mod/translation_editor/views/default/translation_editor/plugin_list.php
new file mode 100644
index 000000000..b48b94fbf
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/plugin_list.php
@@ -0,0 +1,84 @@
+<?php
+ $plugins = $vars["plugins"];
+ $current_language = $vars["current_language"];
+
+ if(!empty($plugins)){
+ $total = 0;
+ $exists = 0;
+ $custom = 0;
+
+ $list .= "<table id='translation_editor_plugin_list' class='elgg-table' title=\"" . elgg_echo("translation_editor:plugin_list:title") . "\">";
+ $list .= "<tr>";
+ $list .= "<th class='first_col'>" . elgg_echo("translation_editor:plugin_list:plugin") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:total") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:exists") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:custom") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:percentage") . "</th>";
+ $list .= "<th>&nbsp;</th>";
+ $list .= "</tr>";
+
+ foreach($plugins as $plugin_name => $plugin_stats){
+
+ $url = $vars["url"] . "translation_editor/" . $current_language . "/" . $plugin_name;
+
+ $total += $plugin_stats["total"];
+ $exists += $plugin_stats["exists"];
+ $custom += $plugin_stats["custom"];
+
+ if(!empty($plugin_stats["total"])){
+ $percentage = round(($plugin_stats["exists"] / $plugin_stats["total"]) * 100);
+ } else {
+ $percentage = 100;
+ }
+
+ $complete_class = "";
+
+ if($percentage == 100){
+ $complete_class = " class='translation_editor_translation_complete'";
+ } elseif($percentage == 0){
+ $complete_class = " class='translation_editor_translation_needed'";
+ }
+
+ $list .= "<tr>";
+ $list .= "<td class='first_col'><a href='" . $url . "'>" . $plugin_name . "</a></td>";
+ $list .= "<td>" . $plugin_stats["total"] . "</td>";
+ $list .= "<td>" . $plugin_stats["exists"] . "</td>";
+
+ if($plugin_stats["custom"] > 0){
+ $list .= "<td>" . $plugin_stats["custom"] . "</td>";
+ } else {
+ $list .= "<td>&nbsp;</td>";
+ }
+
+ $list .= "<td" . $complete_class . ">" . $percentage . "%</td>";
+
+ if($plugin_stats["custom"] > 0){
+ $merge_url = $vars["url"] . "action/translation_editor/merge?current_language=" . $current_language . "&plugin=" . $plugin_name;
+
+ $list .= "<td>";
+ $list .= elgg_view("output/url", array("href" => $merge_url, "is_action" => true, "title" => elgg_echo("translation_editor:plugin_list:merge"), "text" => elgg_view_icon("download")));
+ if(elgg_is_admin_logged_in()){
+ $delete_url = $vars["url"] . "action/translation_editor/delete?current_language=" . $current_language . "&plugin=" . $plugin_name;
+
+ $list .= elgg_view("output/confirmlink", array("href" => $delete_url, "title" => elgg_echo("delete"), "text" => elgg_view_icon("delete-alt")));
+ }
+ $list .= "</td>";
+ } else {
+ $list .= "<td>&nbsp;</td>";
+ }
+ $list .= "</tr>";
+ }
+
+ $list .= "<tr class='translation_editor_plugin_list_total_row'>";
+ $list .= "<td>&nbsp;</td>";
+ $list .= "<td>" . $total . "</td>";
+ $list .= "<td>" . $exists . "</td>";
+ $list .= "<td>" . $custom . "</td>";
+ $list .= "<td>" . round(($exists / $total) * 100, 2) . "%</td>";
+ $list .= "<td>&nbsp;</td>";
+ $list .= "</tr>";
+
+ $list .= "</table>";
+
+ echo $list;
+ }
diff --git a/mod/translation_editor/views/default/translation_editor/search.php b/mod/translation_editor/views/default/translation_editor/search.php
new file mode 100644
index 000000000..541b33123
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/search.php
@@ -0,0 +1,43 @@
+<?php
+
+ $current_language = $vars["current_language"];
+ $q = $vars["query"];
+ $in_search = $vars["in_search"];
+
+ if(empty($q)){
+ $q = elgg_echo("translation_editor:forms:search:default");
+ }
+
+ // build form
+ $form_data .= "<table><tr><td>";
+
+ $form_data .= elgg_view("input/text", array("name" => "translation_editor_search", "value" => $q));
+
+ $form_data .= "</td><td>&nbsp;";
+
+ $form_data .= elgg_view("input/hidden", array("name" => "language", "value" => $current_language));
+ $form_data .= elgg_view("input/submit", array("value" => elgg_echo("search")));
+
+ $form_data .= "</td></tr></table>";
+ $form = elgg_view("input/form", array("body" => $form_data,
+ "id" => "translation_editor_search_form",
+ "action" => $vars["url"] . "translation_editor/search",
+ "disable_security" => true));
+
+ echo $form;
+ echo "<br />";
+
+?>
+<script type="text/javascript">
+ $(document).ready(function(){
+ $('#translation_editor_search_form input[name="translation_editor_search"]').focus(function(){
+ if($(this).val() == "<?php echo elgg_echo("translation_editor:forms:search:default"); ?>"){
+ $(this).val("");
+ }
+ }).blur(function(){
+ if($(this).val() == ""){
+ $(this).val("<?php echo elgg_echo("translation_editor:forms:search:default"); ?>");
+ }
+ });
+ });
+</script> \ No newline at end of file
diff --git a/mod/translation_editor/views/default/translation_editor/search_results.php b/mod/translation_editor/views/default/translation_editor/search_results.php
new file mode 100644
index 000000000..bb771bd9f
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/search_results.php
@@ -0,0 +1,78 @@
+<?php
+
+ $search_results = $vars["results"];
+ $current_language = $vars["current_language"];
+
+ if(!empty($search_results)){
+ $en_flag_file = "mod/translation_editor/_graphics/flags/en.png";
+
+ if(file_exists(elgg_get_root_path() . $en_flag_file)){
+ $en_flag = "<img src='" . $vars['url'] . $en_flag_file . "' alt='" . elgg_echo("en") . "' title='" . elgg_echo("en") . "'>";
+ } else {
+ $en_flag = "en";
+ }
+
+ $lang_flag_file = "mod/translation_editor/_graphics/flags/" . $current_language . ".png";
+
+ if(file_exists(elgg_get_root_path() . $lang_flag_file)){
+ $lang_flag = "<img src='" . $vars['url'] . $lang_flag_file . "' alt='" . elgg_echo($current_language) . "' title='" . elgg_echo($current_language) . "'>";
+ } else {
+ $lang_flag = $current_language;
+ }
+
+ foreach($search_results as $plugin => $data){
+ $translated_language = $data["current_language"];
+
+ $list .= "<table class='elgg-table translation_editor_translation_table'>";
+ $list .= "<col class='first_col'/>";
+ $list .= "<tr class='first_row'><th colspan='2'>";
+ $list .= "<a href='" . $vars["url"] . "translation_editor/" . $current_language . "/" . $plugin . "'>" . $plugin . "</a>";
+ $list .= "</th></tr>";
+
+ foreach($data["en"] as $key => $value){
+
+ // English information
+ $list .= "<tr>";
+ $list .= "<td>" . $en_flag . "</td>";
+ $list .= "<td>";
+ $list .= "<span class='translation_editor_plugin_key' title='" . $key . "'></span>";
+ $list .= "<pre class='translation_editor_pre'>" . nl2br(htmlspecialchars($value)) . "</pre>";
+ $list .="</td>";
+ $list .= "</tr>";
+
+ // Custom language information
+ $list .= "<tr>";
+ $list .= "<td>" . $lang_flag . "</td>";
+ $list .= "<td>";
+ $list .= "<textarea name='translation[" . $plugin . "][" . $key . "]' onchange='translationEditorJQuerySearchSave();'>";
+ $list .= $translated_language[$key];
+ $list .= "</textarea>";
+ $list .= "</td>";
+ $list .= "</tr>";
+ }
+
+ $list .= "</table>";
+ }
+
+ $form_data = elgg_view("input/hidden", array("name" => "current_language", "value" => $current_language));
+ $form_data .= $list;
+
+ $form_data .= elgg_view("input/submit", array("value" => elgg_echo("save")));
+
+ $list = elgg_view("input/form", array("body" => $form_data,
+ "action" => $vars["url"] . "action/translation_editor/translate_search",
+ "id" => "translation_editor_search_result_form"));
+ } else {
+ $list .= elgg_echo("translation_editor:search_results:no_results");
+ }
+
+ echo $list;
+?>
+<style type="text/css">
+ .translation_editor_translation_table tr {
+ display: table-row;
+ <!--
+ display: inline-block;
+ -->
+ }
+</style>