From 49bafba0e590db57005cb9b67f852c9a045160ee Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 5 Mar 2015 17:03:21 +0100 Subject: [PATCH] plugins: allow localization in plugin.cfg Example: name=Default plugin name description=Default plugin desription name.deutsch=Deutscher Plugin-Name name.english=English plugin name Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4baeab43531abe17ecd8367be4af8aa48e56bcd2 Author: vanhofen Date: 2015-03-05 (Thu, 05 Mar 2015) Origin message was: ------------------ - plugins: allow localization in plugin.cfg Example: name=Default plugin name description=Default plugin desription name.deutsch=Deutscher Plugin-Name name.english=English plugin name ------------------ This commit was generated by Migit --- src/gui/plugins.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 1d43cbf75..4e05a4dcb 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -200,6 +200,8 @@ bool CPlugins::parseCfg(plugin *plugin_data) plugin_data->index = sindex++; plugin_data->key = CRCInput::RC_nokey; + plugin_data->name = ""; + plugin_data->description = ""; #if 0 plugin_data->fb = false; plugin_data->rc = false; @@ -235,14 +237,24 @@ bool CPlugins::parseCfg(plugin *plugin_data) { plugin_data->key = getPluginKey(parm); } - else if (cmd == "name") + else if (cmd == "name." + g_settings.language) { plugin_data->name = parm; } - else if (cmd == "desc") + else if (cmd == "name") + { + if (plugin_data->name.empty()) + plugin_data->name = parm; + } + else if (cmd == "desc." + g_settings.language) { plugin_data->description = parm; } + else if (cmd == "desc") + { + if (plugin_data->description.empty()) + plugin_data->description = parm; + } else if (cmd == "depend") { plugin_data->depend = parm; @@ -302,6 +314,9 @@ bool CPlugins::parseCfg(plugin *plugin_data) inFile.close(); + if (plugin_data->name.empty()) + plugin_data->name = plugin_data->filename; + _hintIcon = plugin_data->plugindir + "/" + plugin_data->hinticon + ".png"; if (access(_hintIcon.c_str(), F_OK) == 0) plugin_data->hinticon = _hintIcon;