PluginSystem: support for translations via extra/optional i18n/ folder in the plugin

This commit is contained in:
ItsLemmy
2025-12-02 21:54:23 -05:00
parent 0554db8cf7
commit b031041ccc
4 changed files with 221 additions and 2 deletions
+16
View File
@@ -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