-Fixed bug in translation remaps, also added proper demo, maybe fixes #1729
This commit is contained in:
parent
dc3d0bdf38
commit
4363798608
20
demos/gui/translation/controls.gd
Normal file
20
demos/gui/translation/controls.gd
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
extends Panel
|
||||||
|
|
||||||
|
# member variables here, example:
|
||||||
|
# var a=2
|
||||||
|
# var b="textvar"
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
# Initialization here
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_back_pressed():
|
||||||
|
var s = load("res://main.scn")
|
||||||
|
var si = s.instance()
|
||||||
|
get_parent().add_child(si)
|
||||||
|
queue_free()
|
||||||
|
pass # replace with function body
|
Binary file not shown.
@ -6,3 +6,4 @@ main_scene="res://main.scn"
|
|||||||
[locale]
|
[locale]
|
||||||
|
|
||||||
translations=["res://translations/text.en.xl", "res://translations/text.es.xl", "res://translations/text.ja.xl"]
|
translations=["res://translations/text.en.xl", "res://translations/text.es.xl", "res://translations/text.ja.xl"]
|
||||||
|
translation_remaps={"res://flag_uk.png":["res://flag_spain.png:es", "res://flag_japan.png:ja"]}
|
||||||
|
BIN
demos/gui/translation/flag_japan.png
Normal file
BIN
demos/gui/translation/flag_japan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
demos/gui/translation/flag_spain.png
Normal file
BIN
demos/gui/translation/flag_spain.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
BIN
demos/gui/translation/flag_uk.png
Normal file
BIN
demos/gui/translation/flag_uk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
@ -916,8 +916,8 @@ void ProjectSettings::_translation_res_option_changed() {
|
|||||||
|
|
||||||
|
|
||||||
ERR_FAIL_COND(!remaps.has(key));
|
ERR_FAIL_COND(!remaps.has(key));
|
||||||
StringArray r = remaps[key];
|
StringArray r = remaps[key];
|
||||||
ERR_FAIL_INDEX(idx,remaps.size());
|
ERR_FAIL_INDEX(idx,r.size());
|
||||||
r.set(idx,path+":"+langs[which]);
|
r.set(idx,path+":"+langs[which]);
|
||||||
remaps[key]=r;
|
remaps[key]=r;
|
||||||
|
|
||||||
@ -1095,6 +1095,7 @@ void ProjectSettings::_update_translations() {
|
|||||||
t2->set_editable(1,true);
|
t2->set_editable(1,true);
|
||||||
t2->set_metadata(1,path);
|
t2->set_metadata(1,path);
|
||||||
int idx = langs.find(locale);
|
int idx = langs.find(locale);
|
||||||
|
print_line("find "+locale+" at "+itos(idx));
|
||||||
if (idx<0)
|
if (idx<0)
|
||||||
idx=0;
|
idx=0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user