diff options
-rw-r--r-- | core/translation.cpp | 74 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 4 | ||||
-rw-r--r-- | scene/resources/surface_tool.cpp | 4 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 4 |
4 files changed, 69 insertions, 17 deletions
diff --git a/core/translation.cpp b/core/translation.cpp index 81f2c36075..6ad34651b2 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -550,7 +550,7 @@ StringName TranslationServer::translate(const StringName& p_message) const { continue; // locale not match //near match - bool match = (l!=lptr); + bool match = (l!=locale); if (near_match && !match) continue; //only near-match once @@ -570,6 +570,42 @@ StringName TranslationServer::translate(const StringName& p_message) const { } + if (!res) { + //try again with fallback + if (fallback.length()>=2) { + + const CharType *fptr=&fallback[0]; + bool near_match=false; + for (const Set< Ref<Translation> >::Element *E=translations.front();E;E=E->next()) { + + const Ref<Translation>& t = E->get(); + String l = t->get_locale(); + if (fptr[0]!=l[0] || fptr[1]!=l[1]) + continue; // locale not match + + //near match + bool match = (l!=fallback); + + if (near_match && !match) + continue; //only near-match once + + StringName r=t->get_message(p_message); + + if (!r) + continue; + + res=r; + + if (match) + break; + else + near_match=true; + + } + } + } + + if (!res) return p_message; @@ -604,9 +640,27 @@ bool TranslationServer::_load_translations(const String& p_from) { void TranslationServer::setup() { - - set_locale( GLOBAL_DEF("locale/default",OS::get_singleton()->get_locale()) ); - fallback = GLOBAL_DEF("locale/fallback",""); + String test = GLOBAL_DEF("locale/test",""); + test=test.strip_edges(); + if (test!="") + set_locale( test ); + else + set_locale( OS::get_singleton()->get_locale() ); + fallback = GLOBAL_DEF("locale/fallback","en"); +#ifdef TOOLS_ENABLED + + { + String options=""; + int idx=0; + while(locale_list[idx]) { + if (idx>0) + options+=", "; + options+=locale_list[idx]; + idx++; + } + Globals::get_singleton()->set_custom_property_info("locale/fallback",PropertyInfo(Variant::STRING,"locale/fallback",PROPERTY_HINT_ENUM,options)); + } +#endif //load translations } @@ -629,6 +683,7 @@ void TranslationServer::load_translations() { String locale = get_locale(); bool found = _load_translations("locale/translations"); //all + if (_load_translations("locale/translations_"+locale.substr(0,2))) found=true; if ( locale.substr(0,2) != locale ) { @@ -637,17 +692,6 @@ void TranslationServer::load_translations() { } - if (!found && fallback!="") { //none found anywhere, use fallback - - _load_translations("locale/translations_"+fallback.substr(0,2)); - if ( fallback.substr(0,2) != fallback ) { - _load_translations("locale/translations_"+fallback); - } - - this->locale=fallback; - - } - } TranslationServer::TranslationServer() { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 8afcbf3283..50a440e91c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1957,7 +1957,11 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { update(); } break; case KEY_SPACE: { +#ifdef OSX_ENABLED + if (completion_enabled && k.mod.meta) { //cmd-space is spotlight shortcut in OSX +#else if (completion_enabled && k.mod.command) { +#endif query_code_comple(); scancode_handled=true; diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index dd39205932..113fd8209d 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -650,8 +650,8 @@ void SurfaceTool::mikktGetTexCoord(const SMikkTSpaceContext * pContext, float fv Vector<List<Vertex>::Element*> &varr = *((Vector<List<Vertex>::Element*>*)pContext->m_pUserData); Vector2 v = varr[iFace*3+iVert]->get().uv; fvTexcOut[0]=v.x; - //fvTexcOut[1]=v.y; - fvTexcOut[1]=1.0-v.y; + fvTexcOut[1]=v.y; + //fvTexcOut[1]=1.0-v.y; } void SurfaceTool::mikktSetTSpaceBasic(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert){ diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 2e5f267d5c..439d8273c7 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1602,7 +1602,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { edit_menu->get_popup()->add_item("Toggle Comment",EDIT_TOGGLE_COMMENT,KEY_MASK_CMD|KEY_K); edit_menu->get_popup()->add_item("Clone Down",EDIT_CLONE_DOWN,KEY_MASK_CMD|KEY_B); edit_menu->get_popup()->add_separator(); +#ifdef OSX_ENABLED + edit_menu->get_popup()->add_item("Complete Symbol",EDIT_COMPLETE,KEY_MASK_META|KEY_SPACE); +#else edit_menu->get_popup()->add_item("Complete Symbol",EDIT_COMPLETE,KEY_MASK_CMD|KEY_SPACE); +#endif edit_menu->get_popup()->add_item("Auto Indent",EDIT_AUTO_INDENT,KEY_MASK_CMD|KEY_I); edit_menu->get_popup()->connect("item_pressed", this,"_menu_option"); |