first Prototype
This commit is contained in:
parent
e11825c698
commit
35ce267482
481 changed files with 17315 additions and 1 deletions
|
|
@ -0,0 +1,17 @@
|
|||
# LocalizationEditor PseudolocalizationControl: MIT License
|
||||
# @author Vladimir Petrenko
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
const _pseudolocalization_control: String = "internationalization/pseudolocalization/use_pseudolocalization_control"
|
||||
|
||||
@onready var _pseudolocalization_ui: CheckBox = $HBox/Panel/PseudolocalizationControl
|
||||
|
||||
func _ready():
|
||||
if ProjectSettings.has_setting(_pseudolocalization_control):
|
||||
_pseudolocalization_ui.button_pressed = ProjectSettings.get_setting(_pseudolocalization_control)
|
||||
_pseudolocalization_ui.toggled.connect(_on_pseudolocalization_toggled)
|
||||
|
||||
func _on_pseudolocalization_toggled(button_pressed: bool) -> void:
|
||||
ProjectSettings.set_setting(_pseudolocalization_control, button_pressed)
|
||||
ProjectSettings.save()
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://buetkc0boro05
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b3jy757hoeaso"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/localization_editor/scenes/pseudolocalization/control/LocalizationPseudolocalizationControl.gd" id="1_an27a"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvfcmuubc6npi" path="res://addons/localization_editor/scenes/pseudolocalization/control/LocalizationPseudolocalizationUI.tscn" id="2_jxw8w"]
|
||||
|
||||
[node name="LocalizationPseudolocalizationControl" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( "1_an27a" )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="."]
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBox"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Use Pseudolocalization Control in UI"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="HBox"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
rect_min_size = Vector2(0, 31)
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="PseudolocalizationControl" type="CheckBox" parent="HBox/Panel"]
|
||||
offset_right = 44.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
button_pressed = true
|
||||
text = "On"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="."]
|
||||
offset_top = 35.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 39.0
|
||||
|
||||
[node name="PseudolocalizationEditorView" parent="." instance=ExtResource( "2_jxw8w" )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_top = 43.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 600.0
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
# LocalizationEditor PseudolocalizationUI: MIT License
|
||||
# @author Vladimir Petrenko
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
const _pseudolocalization: String = "internationalization/pseudolocalization/use_pseudolocalization"
|
||||
const _accents: String = "internationalization/pseudolocalization/replace_with_accents"
|
||||
const _double_vowels: String = "internationalization/pseudolocalization/double_vowels"
|
||||
const _fake_bidi: String = "internationalization/pseudolocalization/fake_bidi"
|
||||
const _override: String = "internationalization/pseudolocalization/override"
|
||||
const _expansion_ratio: String = "internationalization/pseudolocalization/expansion_ratio"
|
||||
const _prefix: String = "internationalization/pseudolocalization/prefix"
|
||||
const _suffix: String = "internationalization/pseudolocalization/suffix"
|
||||
const _skip_placeholders: String = "internationalization/pseudolocalization/skip_placeholders"
|
||||
|
||||
@onready var _pseudolocalization_ui: CheckBox = $HBoxPseudolocalization/Panel/Pseudolocalization
|
||||
@onready var _accents_ui: CheckBox = $HBoxAccents/Panel/Accents
|
||||
@onready var _double_vowels_ui: CheckBox = $HBoxDoubleVowels/Panel/DoubleVowels
|
||||
@onready var _fake_bidi_ui: CheckBox = $HBoxFakeBidi/Panel/FakeBidi
|
||||
@onready var _override_ui: CheckBox = $HBoxOverride/Panel/Override
|
||||
@onready var _expansion_ratio_ui: LineEdit = $HBoxExpansionRatio/ExpansionRatio
|
||||
@onready var _prefix_ui: LineEdit = $HBoxPrefix/ExpansionPrefix
|
||||
@onready var _suffix_ui: LineEdit = $HBoxSuffix/ExpansionSuffix
|
||||
@onready var _skip_placeholders_ui: CheckBox = $HBoxSkipPlaceholders/Panel/SkipPlaceholders
|
||||
|
||||
func _ready() -> void:
|
||||
_init_vars()
|
||||
_init_connections()
|
||||
|
||||
func _init_vars() -> void:
|
||||
_pseudolocalization_ui.button_pressed = TranslationServer.is_pseudolocalization_enabled()
|
||||
_accents_ui.button_pressed = ProjectSettings.get(_accents)
|
||||
_double_vowels_ui.button_pressed = ProjectSettings.get(_double_vowels)
|
||||
_fake_bidi_ui.button_pressed = ProjectSettings.get(_fake_bidi)
|
||||
_override_ui.button_pressed = ProjectSettings.get(_override)
|
||||
_expansion_ratio_ui.text = str(ProjectSettings.get(_expansion_ratio))
|
||||
_prefix_ui.text = ProjectSettings.get(_prefix)
|
||||
_suffix_ui.text = ProjectSettings.get(_suffix)
|
||||
_skip_placeholders_ui.button_pressed = ProjectSettings.get(_skip_placeholders)
|
||||
|
||||
func _init_connections() -> void:
|
||||
_pseudolocalization_ui.toggled.connect(_on_pseudolocalization_toggled)
|
||||
_accents_ui.toggled.connect(_on_accents_toggled)
|
||||
_double_vowels_ui.toggled.connect(_on_double_vowels_toggled)
|
||||
_fake_bidi_ui.toggled.connect(_on_fake_bidi_toggled)
|
||||
_override_ui.toggled.connect(_on_override_toggled)
|
||||
_expansion_ratio_ui.text_changed.connect(_on_expansion_ratio_text_changed)
|
||||
_prefix_ui.text_changed.connect(_on_prefix_text_changed)
|
||||
_suffix_ui.text_changed.connect(_on_suffix_text_changed)
|
||||
_skip_placeholders_ui.toggled.connect(_on_skip_placeholders_toggled)
|
||||
|
||||
func _on_pseudolocalization_toggled(button_pressed: bool) -> void:
|
||||
_change_project_setting(_pseudolocalization, button_pressed)
|
||||
TranslationServer.set_pseudolocalization_enabled(button_pressed)
|
||||
|
||||
func _on_accents_toggled(button_pressed: bool) -> void:
|
||||
_change_project_setting(_accents, button_pressed)
|
||||
|
||||
func _on_double_vowels_toggled(button_pressed: bool) -> void:
|
||||
_change_project_setting(_double_vowels, button_pressed)
|
||||
|
||||
func _on_fake_bidi_toggled(button_pressed: bool) -> void:
|
||||
_change_project_setting(_fake_bidi, button_pressed)
|
||||
|
||||
func _on_override_toggled(button_pressed: bool) -> void:
|
||||
_change_project_setting(_override, button_pressed)
|
||||
|
||||
func _on_expansion_ratio_text_changed() -> void:
|
||||
float()
|
||||
var ratio = (_expansion_ratio_ui.text).to_float()
|
||||
if ratio > 1:
|
||||
ratio = 1
|
||||
_expansion_ratio_ui.text = str(ratio)
|
||||
if ratio < 0:
|
||||
ratio = 0
|
||||
_expansion_ratio_ui.text = str(ratio)
|
||||
_change_project_setting(_expansion_ratio, ratio)
|
||||
|
||||
func _on_prefix_text_changed() -> void:
|
||||
_change_project_setting(_prefix, _prefix_ui.text)
|
||||
|
||||
func _on_suffix_text_changed() -> void:
|
||||
_change_project_setting(_suffix, _suffix_ui.text)
|
||||
|
||||
func _on_skip_placeholders_toggled(button_pressed: bool) -> void:
|
||||
_change_project_setting(_skip_placeholders, button_pressed)
|
||||
|
||||
func _change_project_setting(property: String, value: Variant, reload: bool = true, save: bool = true) -> void:
|
||||
ProjectSettings.set(property, value)
|
||||
if reload:
|
||||
TranslationServer.reload_pseudolocalization()
|
||||
if save and Engine.is_editor_hint():
|
||||
ProjectSettings.save()
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://cn1qqdf7vel45
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dvfcmuubc6npi"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/localization_editor/scenes/pseudolocalization/control/LocalizationPseudolocalizationUI.gd" id="1_uf0s3"]
|
||||
|
||||
[node name="PseudolocalizationEditorView" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( "1_uf0s3" )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxPseudolocalization" type="HBoxContainer" parent="."]
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxPseudolocalization"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Use Pseudolocalization"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="HBoxPseudolocalization"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
rect_min_size = Vector2(0, 31)
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Pseudolocalization" type="CheckBox" parent="HBoxPseudolocalization/Panel"]
|
||||
offset_right = 44.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
text = "On"
|
||||
|
||||
[node name="HBoxAccents" type="HBoxContainer" parent="."]
|
||||
offset_top = 35.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 66.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxAccents"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Replace With Accents
|
||||
"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="HBoxAccents"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
rect_min_size = Vector2(0, 31)
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Accents" type="CheckBox" parent="HBoxAccents/Panel"]
|
||||
offset_right = 44.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
button_pressed = true
|
||||
text = "On"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxDoubleVowels" type="HBoxContainer" parent="."]
|
||||
offset_top = 70.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 101.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxDoubleVowels"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Double Vowels"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="HBoxDoubleVowels"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
rect_min_size = Vector2(0, 31)
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="DoubleVowels" type="CheckBox" parent="HBoxDoubleVowels/Panel"]
|
||||
offset_right = 44.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
text = "On"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxFakeBidi" type="HBoxContainer" parent="."]
|
||||
offset_top = 105.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 136.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxFakeBidi"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Fake Bidi"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="HBoxFakeBidi"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
rect_min_size = Vector2(0, 31)
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="FakeBidi" type="CheckBox" parent="HBoxFakeBidi/Panel"]
|
||||
offset_right = 44.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
text = "On"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxOverride" type="HBoxContainer" parent="."]
|
||||
offset_top = 140.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 171.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxOverride"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Override"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="HBoxOverride"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
rect_min_size = Vector2(0, 31)
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Override" type="CheckBox" parent="HBoxOverride/Panel"]
|
||||
offset_right = 44.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
text = "On"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxExpansionRatio" type="HBoxContainer" parent="."]
|
||||
offset_top = 175.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 206.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxExpansionRatio"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Expansion Ratio"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ExpansionRatio" type="LineEdit" parent="HBoxExpansionRatio"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
|
||||
[node name="HBoxPrefix" type="HBoxContainer" parent="."]
|
||||
offset_top = 210.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 241.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxPrefix"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Prefix"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ExpansionPrefix" type="LineEdit" parent="HBoxPrefix"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
text = "["
|
||||
|
||||
[node name="HBoxSuffix" type="HBoxContainer" parent="."]
|
||||
offset_top = 245.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 276.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxSuffix"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Suffix"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ExpansionSuffix" type="LineEdit" parent="HBoxSuffix"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
text = "]"
|
||||
|
||||
[node name="HBoxSkipPlaceholders" type="HBoxContainer" parent="."]
|
||||
offset_top = 280.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 311.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxSkipPlaceholders"]
|
||||
offset_right = 510.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Skip Placeholders"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Panel" type="Panel" parent="HBoxSkipPlaceholders"]
|
||||
offset_left = 514.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 31.0
|
||||
rect_min_size = Vector2(0, 31)
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SkipPlaceholders" type="CheckBox" parent="HBoxSkipPlaceholders/Panel"]
|
||||
offset_right = 44.0
|
||||
offset_bottom = 31.0
|
||||
auto_translate = false
|
||||
text = "On"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue