mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Partial localization support - Greek Language
Also added a Preferences window, where the user can change Pixelorama's language. Note that the .csv's delimiter is Tab and not comma.
This commit is contained in:
parent
2369243cfc
commit
ade2d05a1b
32
Main.tscn
32
Main.tscn
|
@ -1294,7 +1294,7 @@ margin_bottom = 42.0
|
|||
margin_top = 5.0
|
||||
margin_right = 46.0
|
||||
margin_bottom = 19.0
|
||||
text = "Width: "
|
||||
text = "Width:"
|
||||
|
||||
[node name="WidthValue" type="SpinBox" parent="CreateNewImage/VBoxContainer/WidthCont"]
|
||||
margin_left = 50.0
|
||||
|
@ -1402,7 +1402,6 @@ margin_right = 200.0
|
|||
margin_bottom = 114.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScaleImage"]
|
||||
editor/display_folded = true
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 192.0
|
||||
|
@ -1414,7 +1413,6 @@ margin_bottom = 14.0
|
|||
text = "Image Size"
|
||||
|
||||
[node name="WidthCont" type="HBoxContainer" parent="ScaleImage/VBoxContainer"]
|
||||
editor/display_folded = true
|
||||
margin_top = 18.0
|
||||
margin_right = 184.0
|
||||
margin_bottom = 42.0
|
||||
|
@ -1423,7 +1421,7 @@ margin_bottom = 42.0
|
|||
margin_top = 5.0
|
||||
margin_right = 46.0
|
||||
margin_bottom = 19.0
|
||||
text = "Width: "
|
||||
text = "Width:"
|
||||
|
||||
[node name="WidthValue" type="SpinBox" parent="ScaleImage/VBoxContainer/WidthCont"]
|
||||
margin_left = 50.0
|
||||
|
@ -1474,6 +1472,30 @@ text = "Nearest"
|
|||
items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cubic", null, false, 2, null, "Trilinear", null, false, 3, null, "Lanczos", null, true, 4, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="PreferencesDialog" type="AcceptDialog" parent="."]
|
||||
editor/display_folded = true
|
||||
margin_right = 200.0
|
||||
margin_bottom = 70.0
|
||||
window_title = "Preferences"
|
||||
|
||||
[node name="LanguageContainer" type="HBoxContainer" parent="PreferencesDialog"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="LanguageLabel" type="Label" parent="PreferencesDialog/LanguageContainer"]
|
||||
margin_top = 12.0
|
||||
margin_right = 57.0
|
||||
margin_bottom = 27.0
|
||||
text = "Language:"
|
||||
|
||||
[node name="LanguageOption" type="OptionButton" parent="PreferencesDialog/LanguageContainer"]
|
||||
margin_left = 61.0
|
||||
margin_right = 142.0
|
||||
margin_bottom = 40.0
|
||||
text = "English"
|
||||
items = [ "System Language", null, false, 0, null, "Greek", null, false, 1, null, "English", null, false, 2, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="AboutDialog" type="AcceptDialog" parent="."]
|
||||
editor/display_folded = true
|
||||
margin_right = 284.0
|
||||
|
@ -1610,6 +1632,8 @@ dialog_text = "Are you sure you want to exit Pixelorama?"
|
|||
[connection signal="popup_hide" from="ExportSprites" to="." method="_can_draw_true"]
|
||||
[connection signal="confirmed" from="ScaleImage" to="." method="_on_ScaleImage_confirmed"]
|
||||
[connection signal="popup_hide" from="ScaleImage" to="." method="_can_draw_true"]
|
||||
[connection signal="popup_hide" from="PreferencesDialog" to="." method="_can_draw_true"]
|
||||
[connection signal="item_selected" from="PreferencesDialog/LanguageContainer/LanguageOption" to="." method="_on_LanguageOption_item_selected"]
|
||||
[connection signal="popup_hide" from="AboutDialog" to="." method="_can_draw_true"]
|
||||
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Website" to="AboutDialog" method="_on_Website_pressed"]
|
||||
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/GitHub" to="AboutDialog" method="_on_GitHub_pressed"]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
extends Control
|
||||
|
||||
var config_cache : ConfigFile = ConfigFile.new()
|
||||
var config_cache := ConfigFile.new()
|
||||
var loaded_locales : Array
|
||||
var current_save_path := ""
|
||||
var current_export_path := ""
|
||||
var opensprite_file_selected := false
|
||||
|
@ -23,9 +24,25 @@ func _ready() -> void:
|
|||
# This property is only available in 3.2alpha or later, so use `set()` to fail gracefully if it doesn't exist.
|
||||
OS.set("min_window_size", Vector2(1152, 648))
|
||||
|
||||
# Restore the window position/size if values are present in the configuration cache
|
||||
#Make sure locales are always sorted, in the same order
|
||||
loaded_locales = TranslationServer.get_loaded_locales()
|
||||
loaded_locales.sort()
|
||||
|
||||
# Load settings from the config file
|
||||
config_cache.load("user://cache.ini")
|
||||
|
||||
# Load language
|
||||
if config_cache.has_section_key("preferences", "locale"):
|
||||
var saved_locale : String = config_cache.get_value("preferences", "locale")
|
||||
TranslationServer.set_locale(saved_locale)
|
||||
|
||||
# Set the language option menu's default selected option to the loaded locale
|
||||
var locale_index := loaded_locales.find(saved_locale)
|
||||
$PreferencesDialog/LanguageContainer/LanguageOption.selected = locale_index + 1
|
||||
else: # If the user doesn't have a language preference, set it to their OS' locale
|
||||
TranslationServer.set_locale(OS.get_locale())
|
||||
|
||||
# Restore the window position/size if values are present in the configuration cache
|
||||
if config_cache.has_section_key("window", "screen"):
|
||||
OS.current_screen = config_cache.get_value("window", "screen")
|
||||
if config_cache.has_section_key("window", "maximized"):
|
||||
|
@ -38,32 +55,33 @@ func _ready() -> void:
|
|||
OS.window_size = config_cache.get_value("window", "size")
|
||||
|
||||
var file_menu_items := {
|
||||
"New..." : KEY_MASK_CTRL + KEY_N,
|
||||
"Open..." : KEY_MASK_CTRL + KEY_O,
|
||||
"Save..." : KEY_MASK_CTRL + KEY_S,
|
||||
"Save as..." : KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_S,
|
||||
"Import..." : KEY_MASK_CTRL + KEY_I,
|
||||
"Export PNG..." : KEY_MASK_CTRL + KEY_E,
|
||||
"Export PNG as..." : KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_E,
|
||||
"Quit" : KEY_MASK_CTRL + KEY_Q
|
||||
tr("New...") : KEY_MASK_CTRL + KEY_N,
|
||||
tr("Open...") : KEY_MASK_CTRL + KEY_O,
|
||||
tr("Save...") : KEY_MASK_CTRL + KEY_S,
|
||||
tr("Save as...") : KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_S,
|
||||
tr("Import PNG...") : KEY_MASK_CTRL + KEY_I,
|
||||
tr("Export PNG...") : KEY_MASK_CTRL + KEY_E,
|
||||
tr("Export PNG as...") : KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_E,
|
||||
tr("Quit") : KEY_MASK_CTRL + KEY_Q
|
||||
}
|
||||
var edit_menu_items := {
|
||||
"Undo" : KEY_MASK_CTRL + KEY_Z,
|
||||
"Redo" : KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Z,
|
||||
"Scale Image" : 0,
|
||||
"Crop Image" : 0,
|
||||
"Clear Selection" : 0,
|
||||
"Flip Horizontal": KEY_MASK_SHIFT + KEY_H,
|
||||
"Flip Vertical": KEY_MASK_SHIFT + KEY_V
|
||||
tr("Undo") : KEY_MASK_CTRL + KEY_Z,
|
||||
tr("Redo") : KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Z,
|
||||
tr("Scale Image") : 0,
|
||||
tr("Crop Image") : 0,
|
||||
tr("Clear Selection") : 0,
|
||||
tr("Flip Horizontal") : KEY_MASK_SHIFT + KEY_H,
|
||||
tr("Flip Vertical") : KEY_MASK_SHIFT + KEY_V,
|
||||
tr("Preferences") : 0
|
||||
}
|
||||
var view_menu_items := {
|
||||
"Tile Mode" : KEY_MASK_CTRL + KEY_T,
|
||||
"Show Grid" : KEY_MASK_CTRL + KEY_G,
|
||||
"Show Rulers": KEY_MASK_CTRL + KEY_R,
|
||||
"Show Guides": KEY_MASK_CTRL + KEY_Y
|
||||
tr("Tile Mode") : KEY_MASK_CTRL + KEY_T,
|
||||
tr("Show Grid") : KEY_MASK_CTRL + KEY_G,
|
||||
tr("Show Rulers") : KEY_MASK_CTRL + KEY_R,
|
||||
tr("Show Guides") : KEY_MASK_CTRL + KEY_Y
|
||||
}
|
||||
var help_menu_items := {
|
||||
"About Pixelorama" : 0
|
||||
tr("About Pixelorama") : 0
|
||||
}
|
||||
var file_menu : PopupMenu = Global.file_menu.get_popup()
|
||||
var edit_menu : PopupMenu = Global.edit_menu.get_popup()
|
||||
|
@ -259,6 +277,9 @@ func edit_menu_id_pressed(id : int) -> void:
|
|||
canvas.layers[canvas.current_layer_index][0].flip_y()
|
||||
canvas.layers[canvas.current_layer_index][0].lock()
|
||||
canvas.handle_redo("Draw")
|
||||
7: #Preferences
|
||||
$PreferencesDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
|
||||
func view_menu_id_pressed(id : int) -> void:
|
||||
match id:
|
||||
|
@ -588,6 +609,15 @@ func _on_ScaleImage_confirmed() -> void:
|
|||
Global.undo_redo.add_do_method(Global, "redo", [Global.canvas])
|
||||
Global.undo_redo.commit_action()
|
||||
|
||||
func _on_LanguageOption_item_selected(ID : int) -> void:
|
||||
if ID == 0:
|
||||
TranslationServer.set_locale(OS.get_locale())
|
||||
else:
|
||||
TranslationServer.set_locale(loaded_locales[ID - 1])
|
||||
|
||||
config_cache.set_value("preferences", "locale", TranslationServer.get_locale())
|
||||
config_cache.save("user://cache.ini")
|
||||
|
||||
func _on_ImportSprites_popup_hide() -> void:
|
||||
if !opensprite_file_selected:
|
||||
Global.can_draw = true
|
||||
|
@ -973,3 +1003,4 @@ func _exit_tree() -> void:
|
|||
config_cache.set_value("window", "position", OS.window_position)
|
||||
config_cache.set_value("window", "size", OS.window_size)
|
||||
config_cache.save("user://cache.ini")
|
||||
|
||||
|
|
41
Translations/#Translations.csv
Normal file
41
Translations/#Translations.csv
Normal file
|
@ -0,0 +1,41 @@
|
|||
id en el
|
||||
OK OK Εντάξει
|
||||
Cancel Cancel Άκυρο
|
||||
Open Open Άνοιγμα
|
||||
Please Confirm... Please Confirm... Παρακαλώ επιβεβαιώστε...
|
||||
Width: Width: Πλάτος:
|
||||
Height: Height: Ύψος:
|
||||
File File Αρχείο
|
||||
Edit Edit Επεξεργασία
|
||||
View View Προβολή
|
||||
Help Help Βοήθεια
|
||||
New... New... Νέο...
|
||||
Open... Open... Άνοιγμα...
|
||||
Save... Save... Αποθήκευση...
|
||||
Save as... Save as... Αποθήκευση ως...
|
||||
Import PNG... Import PNG... Εισαγωγή PNG...
|
||||
Export PNG... Export PNG... Εξαγωγή PNG...
|
||||
Export PNG as... Export PNG as... Εξαγωγή PNG ως...
|
||||
Quit Quit Έξοδος
|
||||
Undo Undo Αναίρεση
|
||||
Redo Redo Ακύρωση αναίρεσης
|
||||
Scale Image Scale Image Κλιμάκωση εικόνας
|
||||
Crop Image Crop Image Περικοπή
|
||||
Clear Selection Clear Selection Καθαρισμός επιλογής
|
||||
Flip Horizontal Flip Horizontal Οριζόντια αναστροφή
|
||||
Flip Vertical Flip Vertical Κάθετη αναστροφή
|
||||
Preferences Preferences Προτιμήσεις
|
||||
Language: Language: Γλώσσα:
|
||||
System Language System Language Γλώσσα Συστήματος
|
||||
English English Αγγλικά
|
||||
Greek Greek Ελληνικά
|
||||
Tile Mode Tile Mode Λειτουργία μοτίβου
|
||||
Show Grid Show Grid Εμφάνιση πλέγματος
|
||||
Show Rulers Show Rulers Εμφάνιση χαράκων
|
||||
Show Guides Show Guides Εμφάνιση οδηγών
|
||||
About Pixelorama About Pixelorama Σχετικά με το Pixelorama
|
||||
Utility Tools Utility Tools Βοηθητικά Εργαλεία
|
||||
Draw Tools Draw Tools Εργαλεία Ζωγραφικής
|
||||
Left tool options Left tool options Επιλογές αριστερού εργαλείου
|
||||
Right tool options Right tool options Επιλογές δεξιού εργαλείου
|
||||
Layers Layers Στρώσεις
|
|
16
Translations/#Translations.csv.import
Normal file
16
Translations/#Translations.csv.import
Normal file
|
@ -0,0 +1,16 @@
|
|||
[remap]
|
||||
|
||||
importer="csv_translation"
|
||||
type="Translation"
|
||||
|
||||
[deps]
|
||||
|
||||
files=[ "res://Translations/#Translations.en.translation", "res://Translations/#Translations.el.translation" ]
|
||||
|
||||
source_file="res://Translations/#Translations.csv"
|
||||
dest_files=[ "res://Translations/#Translations.en.translation", "res://Translations/#Translations.el.translation" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress=true
|
||||
delimiter=2
|
BIN
Translations/#Translations.el.translation
Normal file
BIN
Translations/#Translations.el.translation
Normal file
Binary file not shown.
BIN
Translations/#Translations.en.translation
Normal file
BIN
Translations/#Translations.en.translation
Normal file
Binary file not shown.
|
@ -178,6 +178,11 @@ right_colorpicker_tool={
|
|||
]
|
||||
}
|
||||
|
||||
[locale]
|
||||
|
||||
translations=PoolStringArray( "res://Translations/#Translations.en.translation", "res://Translations/#Translations.el.translation" )
|
||||
locale_filter=[ 0, [ ] ]
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
|
|
Loading…
Reference in a new issue