新增国际化支持

pull/1/head
PJ568 12 months ago
parent 1911ee9feb
commit f2f5d745f0

Binary file not shown.

@ -0,0 +1,10 @@
id,zh,en,zht,jp,es
KEY_ABOUT,关于,About,關於,約,Acerca de
KEY_LICENSE,许可,License,許可証,ライセンス,Licencia
KEY_LICENSEDUNDER,568_Calc 项目遵循 MIT 协议。,568_Calc is licensed under the MIT \nlicense.,568_Calc 由 MIT 授權。,568_Calc は MIT ライセンスで取得済みです。,568_Calc está licenciado bajo la \nlicencia MIT.
KEY_WEBSITE,访问官网,Website,瀏覽官方網站,Web サイト,Visita el sitio web
KEY_SOURCE,访问源代码仓库,Source,瀏覽原始碼儲存庫,ソースコードリポジトリ,Visita el repositorio de código fuente
KEY_ABOUTMIT,关于 MIT 协议,About the MIT license,關於 MIT 許可證,MIT ライセンスについて,acerca de la licencia MIT
KEY_OTHERLICENSE,开放源代码库,Open Source Library,開放源代碼庫,オープンソースライブラリ,otros licencia
KEY_LANGUANGE,语言,Language,語言,言語,Idioma
KEY_SETTING,设置,Configuration,設置,設定,Configuración
1 id zh en zht jp es
2 KEY_ABOUT 关于 About 關於 Acerca de
3 KEY_LICENSE 许可 License 許可証 ライセンス Licencia
4 KEY_LICENSEDUNDER 568_Calc 项目遵循 MIT 协议。 568_Calc is licensed under the MIT \nlicense. 568_Calc 由 MIT 授權。 568_Calc は MIT ライセンスで取得済みです。 568_Calc está licenciado bajo la \nlicencia MIT.
5 KEY_WEBSITE 访问官网 Website 瀏覽官方網站 Web サイト Visita el sitio web
6 KEY_SOURCE 访问源代码仓库 Source 瀏覽原始碼儲存庫 ソースコードリポジトリ Visita el repositorio de código fuente
7 KEY_ABOUTMIT 关于 MIT 协议 About the MIT license 關於 MIT 許可證 MIT ライセンスについて acerca de la licencia MIT
8 KEY_OTHERLICENSE 开放源代码库 Open Source Library 開放源代碼庫 オープンソースライブラリ otros licencia
9 KEY_LANGUANGE 语言 Language 語言 言語 Idioma
10 KEY_SETTING 设置 Configuration 設置 設定 Configuración

@ -0,0 +1,17 @@
[remap]
importer="csv_translation"
type="Translation"
uid="uid://cw2gquc52qt1o"
[deps]
files=["res://Assets/国际化.zh.translation", "res://Assets/国际化.en.translation", "res://Assets/国际化.zht.translation", "res://Assets/国际化.jp.translation", "res://Assets/国际化.es.translation"]
source_file="res://Assets/国际化.csv"
dest_files=["res://Assets/国际化.zh.translation", "res://Assets/国际化.en.translation", "res://Assets/国际化.zht.translation", "res://Assets/国际化.jp.translation", "res://Assets/国际化.es.translation"]
[params]
compress=true
delimiter=0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -57,7 +57,7 @@ func _unhandled_input(event) -> void:
()
if Input.is_action_pressed(""):
()
if Input.is_action_pressed("等于"):
if Input.is_action_pressed("等于") or Input.is_action_pressed("ui_accept"):
()
if Input.is_action_pressed("取反"):
()
@ -192,10 +192,14 @@ func 等于():
"/":
= /
.text = str() + + str() + "="
.text = str(snappedf(, 0.0000000001))
.text = str(snappedf(, 0.0000001))
= false
= false
func _on__pressed():
get_tree().change_scene_to_file("res://关于.tscn")
func _on__pressed():
get_tree().change_scene_to_file("res://设置.tscn")

@ -1,6 +1,10 @@
extends Control
#func _ready():
#TranslationServer.set_locale("es")
func _unhandled_input(event) -> void:
if Input.is_action_pressed("归零") or Input.is_action_pressed("ui_menu") or Input.is_action_pressed("ui_home") or Input.is_action_pressed("ui_text_backspace") or Input.is_action_pressed("关于") or Input.is_action_pressed("ui_cancel"):
_on__pressed()

@ -0,0 +1,40 @@
extends Control
@onready var = $"面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2/语言"
func _ready():
var locale = OS.get_locale()
if locale == "zh_CN":
_on__item_selected(0)
elif locale == "zh_TW":
_on__item_selected(1)
elif locale == "en":
_on__item_selected(2)
elif locale == "jp":
_on__item_selected(3)
elif locale == "es":
_on__item_selected(4)
func _unhandled_input(event) -> void:
if Input.is_action_pressed("归零") or Input.is_action_pressed("ui_menu") or Input.is_action_pressed("ui_home") or Input.is_action_pressed("ui_text_backspace") or Input.is_action_pressed("关于") or Input.is_action_pressed("ui_cancel"):
_on__pressed()
func _on__pressed():
get_tree ().change_scene_to_file("res://主界面.tscn")
func _on__item_selected(index):
if index == 0:
TranslationServer.set_locale("zh")
elif index == 1:
TranslationServer.set_locale("zht")
elif index == 2:
TranslationServer.set_locale("en")
elif index == 3:
TranslationServer.set_locale("jp")
elif index == 4:
TranslationServer.set_locale("es")

@ -91,7 +91,7 @@ window/handheld/orientation=1
}
"等于"={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":61,"key_label":0,"unicode":61,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":61,"physical_keycode":0,"key_label":0,"unicode":61,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194310,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"canceled":false,"pressed":false,"double_click":false,"script":null)
@ -114,7 +114,7 @@ window/handheld/orientation=1
}
"加"={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194437,"key_label":0,"unicode":43,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194437,"physical_keycode":0,"key_label":0,"unicode":43,"echo":false,"script":null)
]
}
"减"={
@ -150,6 +150,10 @@ window/handheld/orientation=1
]
}
[internationalization]
locale/translations=PackedStringArray("res://Assets/国际化.en.translation", "res://Assets/国际化.es.translation", "res://Assets/国际化.jp.translation", "res://Assets/国际化.ko.translation", "res://Assets/国际化.zh.translation", "res://Assets/国际化.zht.translation")
[rendering]
renderer/rendering_method="gl_compatibility"

@ -352,3 +352,4 @@ expand_icon = true
[connection signal="pressed" from="面板/背景色/屏键容器/MarginContainer2/上下键盘分隔/下键盘/_" to="." method="按下点"]
[connection signal="pressed" from="面板/背景色/屏键容器/MarginContainer2/上下键盘分隔/下键盘/=" to="." method="等于"]
[connection signal="pressed" from="面板/背景色/MarginContainer/顶按钮容器/关于" to="." method="_on_关于_pressed"]
[connection signal="pressed" from="面板/背景色/MarginContainer/顶按钮容器/设置" to="." method="_on_设置_pressed"]

@ -57,7 +57,7 @@ offset_bottom = 1157.0
layout_mode = 2
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 96
text = "关于"
text = "KEY_ABOUT"
horizontal_alignment = 1
vertical_alignment = 1
@ -65,23 +65,23 @@ vertical_alignment = 1
layout_mode = 2
[node name="标题" type="Label" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
custom_minimum_size = Vector2(656, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 64
text = "许可:"
text = "KEY_LICENSE"
vertical_alignment = 1
text_overrun_behavior = 2
[node name="正文" type="Label" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
custom_minimum_size = Vector2(656, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 48
text = "568_Calc 项目遵循 MIT 协议。"
text = "KEY_LICENSEDUNDER"
vertical_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
layout_mode = 2
[node name="网页" type="LinkButton" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2/HBoxContainer"]
[node name="网页" type="LinkButton" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
custom_minimum_size = Vector2(256, 64)
layout_mode = 2
size_flags_horizontal = 6
@ -89,10 +89,10 @@ size_flags_vertical = 6
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 48
theme_override_styles/focus = SubResource("StyleBoxEmpty_cx36f")
text = "访问官网"
text = "KEY_WEBSITE"
uri = "https://Calc.PJ568.eu.org"
[node name="访问" type="LinkButton" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2/HBoxContainer"]
[node name="访问" type="LinkButton" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
custom_minimum_size = Vector2(256, 64)
layout_mode = 2
size_flags_horizontal = 6
@ -100,7 +100,7 @@ size_flags_vertical = 6
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 48
theme_override_styles/focus = SubResource("StyleBoxEmpty_cx36f")
text = "访问源代码仓库"
text = "KEY_SOURCE"
uri = "https://github.com/PJ-568/568_Calc"
[node name="MIT" type="LinkButton" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
@ -111,18 +111,20 @@ size_flags_vertical = 6
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 48
theme_override_styles/focus = SubResource("StyleBoxEmpty_cx36f")
text = "关于 MIT 协议"
text = "KEY_ABOUTMIT"
uri = "https://mit-license.org/"
[node name="正文和按钮分隔" type="VBoxContainer" parent="面板/背景色/MarginContainer/色/内容按钮分隔"]
layout_mode = 2
[node name="标题" type="Label" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和按钮分隔"]
custom_minimum_size = Vector2(656, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 64
text = "开放源代码库:"
text = "KEY_OTHERLICENSE"
vertical_alignment = 1
text_overrun_behavior = 2
[node name="按钮" type="GridContainer" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和按钮分隔"]
layout_mode = 2
@ -165,7 +167,7 @@ uri = "https://github.com/atelier-anchor/smiley-sans"
custom_minimum_size = Vector2(175, 64)
layout_mode = 2
size_flags_horizontal = 6
size_flags_vertical = 4
size_flags_vertical = 8
theme_override_fonts/font = ExtResource("1_8vcuf")
theme_override_font_sizes/font_size = 64
theme_override_styles/normal = ExtResource("2_qbs1x")

@ -0,0 +1,104 @@
[gd_scene load_steps=5 format=3 uid="uid://c85gt4vl44w2d"]
[ext_resource type="Script" path="res://Scripts/设置.gd" id="1_lygu4"]
[ext_resource type="FontFile" uid="uid://c3lj58l2mmrld" path="res://Font/SmileySans-Oblique.ttf" id="2_fcls7"]
[ext_resource type="StyleBox" uid="uid://diyafdj4q00tg" path="res://Assets/样式/正常数字.tres" id="3_7nmxr"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cx36f"]
[node name="设置" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_lygu4")
[node name="面板" type="Panel" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="背景色" type="ColorRect" parent="面板"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.129412, 0.129412, 0.129412, 1)
[node name="MarginContainer" type="MarginContainer" parent="面板/背景色"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32
[node name="色" type="ColorRect" parent="面板/背景色/MarginContainer"]
layout_mode = 2
color = Color(0.196078, 0.196078, 0.196078, 1)
[node name="内容按钮分隔" type="VBoxContainer" parent="面板/背景色/MarginContainer/色"]
layout_mode = 2
offset_right = 656.0
offset_bottom = 1157.0
[node name="标题" type="Label" parent="面板/背景色/MarginContainer/色/内容按钮分隔"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_fcls7")
theme_override_font_sizes/font_size = 96
text = "KEY_SETTING"
horizontal_alignment = 1
vertical_alignment = 1
text_overrun_behavior = 2
[node name="正文和标题分隔2" type="VBoxContainer" parent="面板/背景色/MarginContainer/色/内容按钮分隔"]
layout_mode = 2
[node name="标题" type="Label" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_fcls7")
theme_override_font_sizes/font_size = 64
text = "KEY_LANGUANGE"
vertical_alignment = 1
text_overrun_behavior = 2
[node name="语言" type="OptionButton" parent="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_fcls7")
theme_override_font_sizes/font_size = 48
item_count = 5
popup/item_0/text = "简体中文"
popup/item_0/id = 0
popup/item_1/text = "繁體中文(臺灣)"
popup/item_1/id = 1
popup/item_2/text = "English"
popup/item_2/id = 2
popup/item_3/text = "日本語"
popup/item_3/id = 3
popup/item_4/text = "Español"
popup/item_4/id = 4
[node name="返回" type="Button" parent="面板/背景色/MarginContainer/色/内容按钮分隔"]
custom_minimum_size = Vector2(175, 64)
layout_mode = 2
size_flags_horizontal = 6
size_flags_vertical = 8
theme_override_fonts/font = ExtResource("2_fcls7")
theme_override_font_sizes/font_size = 64
theme_override_styles/normal = ExtResource("3_7nmxr")
theme_override_styles/focus = SubResource("StyleBoxEmpty_cx36f")
text = "←"
[connection signal="item_selected" from="面板/背景色/MarginContainer/色/内容按钮分隔/正文和标题分隔2/语言" to="." method="_on_语言_item_selected"]
[connection signal="pressed" from="面板/背景色/MarginContainer/色/内容按钮分隔/返回" to="." method="_on_返回_pressed"]
Loading…
Cancel
Save