From 2d9b20157957a55bd83875775085ed31c9062577 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Mar 2014 14:58:52 -0300 Subject: Squashed 'mod/translation_editor/' content from commit 9d86955 git-subtree-dir: mod/translation_editor git-subtree-split: 9d86955e6d8b6807578f5a9da0346ac1a146881c --- .../default/translation_editor/add_custom_key.php | 21 +++ views/default/translation_editor/add_language.php | 167 +++++++++++++++++++++ views/default/translation_editor/css/site.php | 99 ++++++++++++ views/default/translation_editor/js/site.php | 41 +++++ .../translation_editor/language_selector.php | 88 +++++++++++ views/default/translation_editor/plugin_edit.php | 147 ++++++++++++++++++ views/default/translation_editor/plugin_list.php | 84 +++++++++++ views/default/translation_editor/search.php | 43 ++++++ .../default/translation_editor/search_results.php | 78 ++++++++++ 9 files changed, 768 insertions(+) create mode 100644 views/default/translation_editor/add_custom_key.php create mode 100644 views/default/translation_editor/add_language.php create mode 100644 views/default/translation_editor/css/site.php create mode 100644 views/default/translation_editor/js/site.php create mode 100644 views/default/translation_editor/language_selector.php create mode 100644 views/default/translation_editor/plugin_edit.php create mode 100644 views/default/translation_editor/plugin_list.php create mode 100644 views/default/translation_editor/search.php create mode 100644 views/default/translation_editor/search_results.php (limited to 'views/default/translation_editor') diff --git a/views/default/translation_editor/add_custom_key.php b/views/default/translation_editor/add_custom_key.php new file mode 100644 index 000000000..4726479cc --- /dev/null +++ b/views/default/translation_editor/add_custom_key.php @@ -0,0 +1,21 @@ +"; + $form_body .= ""; + $form_body .= elgg_view("input/text", array("name" => "key")); + + $form_body .= ""; + $form_body .= ""; + $form_body .= "" . elgg_echo("translation_editor:custom_keys:translation_info") . ""; + $form_body .= ""; + + $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")); + +?> +

+ "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 "
"; + echo "+ " . elgg_echo("translation_editor:language_selector:add_language") . ""; + echo $form; + echo "
"; diff --git a/views/default/translation_editor/css/site.php b/views/default/translation_editor/css/site.php new file mode 100644 index 000000000..941ccdb7a --- /dev/null +++ b/views/default/translation_editor/css/site.php @@ -0,0 +1,99 @@ + + +#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; + +} + +.translation_editor_plugin_key { + float: right; + width: 16px; + height: 16px; + background: url(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/views/default/translation_editor/js/site.php b/views/default/translation_editor/js/site.php new file mode 100644 index 000000000..be4dc0266 --- /dev/null +++ b/views/default/translation_editor/js/site.php @@ -0,0 +1,41 @@ + +// + +
+
+ + + ' /> + elgg_echo("save"))); + ?> +
+
diff --git a/views/default/translation_editor/plugin_list.php b/views/default/translation_editor/plugin_list.php new file mode 100644 index 000000000..b48b94fbf --- /dev/null +++ b/views/default/translation_editor/plugin_list.php @@ -0,0 +1,84 @@ +"; + $list .= ""; + $list .= "" . elgg_echo("translation_editor:plugin_list:plugin") . ""; + $list .= "" . elgg_echo("translation_editor:plugin_list:total") . ""; + $list .= "" . elgg_echo("translation_editor:plugin_list:exists") . ""; + $list .= "" . elgg_echo("translation_editor:plugin_list:custom") . ""; + $list .= "" . elgg_echo("translation_editor:plugin_list:percentage") . ""; + $list .= " "; + $list .= ""; + + 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 .= ""; + $list .= "" . $plugin_name . ""; + $list .= "" . $plugin_stats["total"] . ""; + $list .= "" . $plugin_stats["exists"] . ""; + + if($plugin_stats["custom"] > 0){ + $list .= "" . $plugin_stats["custom"] . ""; + } else { + $list .= " "; + } + + $list .= "" . $percentage . "%"; + + if($plugin_stats["custom"] > 0){ + $merge_url = $vars["url"] . "action/translation_editor/merge?current_language=" . $current_language . "&plugin=" . $plugin_name; + + $list .= ""; + $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 .= ""; + } else { + $list .= " "; + } + $list .= ""; + } + + $list .= ""; + $list .= " "; + $list .= "" . $total . ""; + $list .= "" . $exists . ""; + $list .= "" . $custom . ""; + $list .= "" . round(($exists / $total) * 100, 2) . "%"; + $list .= " "; + $list .= ""; + + $list .= ""; + + echo $list; + } diff --git a/views/default/translation_editor/search.php b/views/default/translation_editor/search.php new file mode 100644 index 000000000..541b33123 --- /dev/null +++ b/views/default/translation_editor/search.php @@ -0,0 +1,43 @@ +"; + + $form_data .= elgg_view("input/text", array("name" => "translation_editor_search", "value" => $q)); + + $form_data .= " "; + + $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 .= ""; + $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 "
"; + +?> + \ No newline at end of file diff --git a/views/default/translation_editor/search_results.php b/views/default/translation_editor/search_results.php new file mode 100644 index 000000000..bb771bd9f --- /dev/null +++ b/views/default/translation_editor/search_results.php @@ -0,0 +1,78 @@ +"; + } 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 = "" . elgg_echo($current_language)  . ""; + } else { + $lang_flag = $current_language; + } + + foreach($search_results as $plugin => $data){ + $translated_language = $data["current_language"]; + + $list .= ""; + $list .= ""; + $list .= ""; + + foreach($data["en"] as $key => $value){ + + // English information + $list .= ""; + $list .= ""; + $list .= ""; + $list .= ""; + + // Custom language information + $list .= ""; + $list .= ""; + $list .= ""; + $list .= ""; + } + + $list .= "
"; + $list .= "" . $plugin . ""; + $list .= "
" . $en_flag . ""; + $list .= ""; + $list .= "
" . nl2br(htmlspecialchars($value)) . "
"; + $list .="
" . $lang_flag . ""; + $list .= ""; + $list .= "
"; + } + + $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; +?> + -- cgit v1.2.3