Translations via string table#2
Open
popiel wants to merge 1 commit into
Open
Conversation
Reviewer's GuideAdds a locale-aware string table and translation helper to support English and Chinese UI text for the Copy All Errors plugin, wiring all user-facing strings to this mechanism and caching editor locale detection. Sequence diagram for locale detection and button injectionsequenceDiagram
participant GodotEditor
participant EditorInterface
participant CopyAllErrorsPlugin
participant ErrorPanel
participant CopyButton
GodotEditor->>CopyAllErrorsPlugin: _enter_tree()
activate CopyAllErrorsPlugin
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: _schedule_retry()
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: _find_error_panel(root)
CopyAllErrorsPlugin->>ErrorPanel: scan_children()
ErrorPanel-->>CopyAllErrorsPlugin: Button ExpandAll_or_全部展开
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: set _detected_ui_is_english
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: _inject_copy_button()
activate CopyAllErrorsPlugin
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: _tr(button_text)
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: _get_locale()
alt editor language available
CopyAllErrorsPlugin->>EditorInterface: get_editor_language()
EditorInterface-->>CopyAllErrorsPlugin: editor_lang
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: cache locale from editor_lang
else editor language not available
CopyAllErrorsPlugin->>CopyAllErrorsPlugin: locale = en or zh from _detected_ui_is_english
end
CopyAllErrorsPlugin-->>CopyButton: set text and tooltip via _tr
deactivate CopyAllErrorsPlugin
GodotEditor-->>CopyAllErrorsPlugin: editor ready
Class diagram for localized CopyAllErrors plugin structureclassDiagram
class CopyAllErrorsPlugin {
<<EditorPlugin>>
+const _STRINGS
+const _MAX_RETRIES
-Button _copy_button
-Tree _error_tree
-HBoxContainer _hbox
-Timer _setup_timer
-int _retry_count
-String _cached_locale
-bool _detected_ui_is_english
+void _enter_tree()
+void _exit_tree()
+String _get_locale()
+String _tr(key)
+void _schedule_retry()
+Dictionary _find_error_panel(node)
+void _inject_copy_button()
+void _on_copy_all_pressed()
+void _flash_button(msg)
+String _get_type_char(item)
}
EditorPlugin <|-- CopyAllErrorsPlugin
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support both Chinese and English button labels and messages, based on the editor's locale setting.
Summary by Sourcery
Add locale-aware string table for the Copy All Errors editor plugin and localize its UI text and messages to English and Chinese based on the editor language.
New Features:
Enhancements: