mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
PluginSystem: support for translations via extra/optional i18n/ folder in the plugin
This commit is contained in:
@@ -35,9 +35,25 @@ Item {
|
||||
asynchronous: false
|
||||
sourceComponent: BarWidgetRegistry.getWidget(widgetId)
|
||||
|
||||
// Create a dummy pluginApi that returns empty strings to avoid undefined warnings
|
||||
property var _dummyApi: QtObject {
|
||||
function tr(key) {
|
||||
return "";
|
||||
}
|
||||
function trp(key, count) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// Inject dummy API immediately to prevent undefined warnings during initialization
|
||||
if (BarWidgetRegistry.isPluginWidget(widgetId) && item.hasOwnProperty("pluginApi") && !item.pluginApi) {
|
||||
item.pluginApi = _dummyApi;
|
||||
}
|
||||
|
||||
Logger.d("BarWidgetLoader", "Loading widget", widgetId, "on screen:", widgetScreen.name);
|
||||
|
||||
// Apply properties to loaded widget
|
||||
|
||||
Reference in New Issue
Block a user