Skip to content


Browse files Browse the repository at this point in the history
[Plugin Manager] Translateable name and description in metadata.txt.
  • Loading branch information
borysiasty committed Jun 11, 2013
1 parent 74f08c5 commit 50bf791
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions python/pyplugin_installer/
Expand Up @@ -97,15 +97,15 @@

translatableAttributes = ["name", "description", "tags"]

reposGroup = "/Qgis/plugin-repos"
settingsGroup = "/Qgis/plugin-installer"
seenPluginGroup = "/Qgis/plugin-seen"

# Repositories: (name, url, possible depreciated url)
officialRepo = ("QGIS Official Repository", "","")
officialRepo = ( QCoreApplication.translate("QgsPluginInstaller", "QGIS Official Plugin Repository"), "","")
depreciatedRepos = [
("Old QGIS Official Repository", ""),
("Old QGIS Contributed Repository",""),
Expand Down Expand Up @@ -585,7 +585,7 @@ def removeRepository(self, repo):
# ----------------------------------------- #
def getInstalledPlugin(self, key, readOnly, testLoad=True):
""" get the metadata of an installed plugin """
def pluginMetadata(fct):
def metadataParser(fct):
""" plugin metadata parser reimplemented from qgis.utils
for better control on wchich module is examined
in case there is an installed plugin masking a core one """
Expand All @@ -599,6 +599,17 @@ def pluginMetadata(fct):
return ""

def pluginMetadata(fct):
""" calls metadataParser for current l10n.
If failed, fallbacks to the standard metadata """
locale = QLocale.system().name()
if locale and fct in translatableAttributes:
value = metadataParser( "%s[%s]" % (fct, locale ) )
if value: return value
value = metadataParser( "%s[%s]" % (fct, locale.split("_")[0] ) )
if value: return value
return metadataParser( fct )

if readOnly:
path = QDir.cleanPath( QgsApplication.pkgDataPath() ) + "/python/plugins/" + key
Expand Down Expand Up @@ -739,13 +750,15 @@ def rebuild(self):
self.mPlugins[key] = plugin # just add a new plugin
# update local plugin with remote metadata
# only use remote icon if local one is not available
if self.mPlugins[key]["icon"] == key and plugin["icon"]:
self.mPlugins[key]["icon"] = plugin["icon"]
# name, description, icon: only use remote data if local one is not available (because of i18n and to not download the icon)
for attrib in translatableAttributes + ["icon"]:
if not self.mPlugins[key][attrib] and plugin[attrib]:
self.mPlugins[key][attrib] = plugin[attrib]
# other remote metadata is preffered:
for attrib in ["name", "description", "category", "tags", "changelog", "author_name", "author_email", "homepage",
"tracker", "code_repository", "experimental", "version_available", "zip_repository",
"download_url", "filename", "downloads", "average_vote", "rating_votes"]:
"download_url", "filename", "downloads", "average_vote", "rating_votes"]
and not attrib in translatableAttributes:
if plugin[attrib]:
self.mPlugins[key][attrib] = plugin[attrib]
# set status
Expand Down

0 comments on commit 50bf791

Please sign in to comment.