Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 294627 Details for
Bug 374871
net-misc/pyload - A fast, lightweight and full featured download manager for many One-Click-Hosters
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
locale wrapper fixup
locale.patch (text/plain), 7.71 KB, created by
Sven E.
on 2011-12-03 18:39:46 UTC
(
hide
)
Description:
locale wrapper fixup
Filename:
MIME Type:
Creator:
Sven E.
Created:
2011-12-03 18:39:46 UTC
Size:
7.71 KB
patch
obsolete
>diff -r 57b634b1b4d0 module/common/pylgettext.py >--- /dev/null Thu Jan 01 00:00:00 1970 +0000 >+++ b/module/common/pylgettext.py Sat Dec 03 19:32:14 2011 +0100 >@@ -0,0 +1,59 @@ >+#!/usr/bin/env python2 >+ >+from gettext import * >+ >+_searchdirs=None >+ >+origfind=find >+ >+def setpaths(pathlist): >+ global _searchdirs >+ if isinstance(pathlist,list): >+ _searchdirs=pathlist >+ else: >+ _searchdirs=list(pathlist) >+ >+def addpath(path): >+ global _searchdirs >+ if _searchdirs is None: >+ _searchdirs=list(path) >+ else: >+ if path not in _searchdirs: >+ _searchdirs.append(path) >+ >+def delpath(path): >+ global _searchdirs >+ if _searchdirs is not None: >+ if path in _searchdirs: >+ _searchdirs.remove(path) >+ >+def clearpath(): >+ global _searchdirs >+ if _searchdirs is not None: >+ _searchdirs=None >+ >+def find(domain, localedir=None, languages=None, all=False): >+ print "Call to find()" >+ if _searchdirs is None: >+ return origfind(domain, localedir, languages, all) >+ searches=[localedir]+_searchdirs >+ print searches >+ results=list() >+ for dir in searches: >+ res=origfind(domain,dir,languages,all) >+ if all is False: >+ results.append(res) >+ else: >+ results.extend(res) >+ if all is False: >+ results=filter(lambda x:x is not None,results) >+ if len(results)==0: >+ return None >+ else: >+ return results[0] >+ else: >+ return results >+ >+#Is there a smarter/cleaner pythonic way for this? >+translation.__globals__['find']=find >+ >diff -r 57b634b1b4d0 module/setup.py >--- a/module/setup.py Fri Dec 02 15:06:51 2011 +0100 >+++ b/module/setup.py Sat Dec 03 19:32:14 2011 +0100 >@@ -17,7 +17,7 @@ > @author: RaNaN > """ > from getpass import getpass >-import gettext >+import module.common.pylgettext as gettext > import os > from os import makedirs > from os.path import abspath >@@ -44,7 +44,8 @@ > > langs = self.config.getMetaData("general", "language")["type"].split(";") > lang = self.ask(u"Choose your Language / Wähle deine Sprache", "en", langs) >- translation = gettext.translation("setup", join(self.path, "locale"), languages=["en", lang]) >+ gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) >+ translation = gettext.translation("setup", join(self.path, "locale"), languages=[lang, "en"],fallback=True) > translation.install(True) > > # print "" >@@ -342,8 +343,8 @@ > self.config["ssl"]["activated"] = self.ask(_("Activate SSL?"), "y", bool=True) > > def set_user(self): >- >- translation = gettext.translation("setup", join(self.path, "locale"), languages=["en", self.config["general"]["language"]]) >+ gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) >+ translation = gettext.translation("setup", join(self.path, "locale"), languages=[self.config["general"]["language"],"en"],fallback=True) > translation.install(True) > > from module.database import DatabaseBackend >@@ -394,7 +395,8 @@ > > def conf_path(self, trans=False): > if trans: >- translation = gettext.translation("setup", join(self.path, "locale"), languages=[self.config["general"]["language"]]) >+ gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) >+ translation = gettext.translation("setup", join(self.path, "locale"), languages=[self.config["general"]["language"], "en"],fallback=True) > translation.install(True) > > print _("Setting new configpath, current configuration will not be transfered!") >diff -r 57b634b1b4d0 module/web/webinterface.py >--- a/module/web/webinterface.py Fri Dec 02 15:06:51 2011 +0100 >+++ b/module/web/webinterface.py Sat Dec 03 19:32:14 2011 +0100 >@@ -18,8 +18,9 @@ > """ > > import sys >-import gettext >+import module.common.pylgettext as gettext > >+import os > from os.path import join, abspath, dirname, exists > from os import makedirs > >@@ -98,8 +99,9 @@ > else: > env.filters["url"] = lambda x: PREFIX + x if x.startswith("/") else x > >+gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) > translation = gettext.translation("django", join(PYLOAD_DIR, "locale"), >- languages=["en", config.get("general", "language")]) >+ languages=[config.get("general", "language"), "en"],fallback=True) > translation.install(True) > env.install_gettext_translations(translation) > >diff -r 57b634b1b4d0 pyLoadCli.py >--- a/pyLoadCli.py Fri Dec 02 15:06:51 2011 +0100 >+++ b/pyLoadCli.py Sat Dec 03 19:32:14 2011 +0100 >@@ -20,7 +20,7 @@ > from __future__ import with_statement > from getopt import GetoptError, getopt > >-import gettext >+import module.common.pylgettext as gettext > import os > from os import _exit > from os.path import join, exists, abspath, basename >@@ -490,8 +490,9 @@ > for opt in configFile.items("cli"): > config[opt[0]] = opt[1] > >+ gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) > translation = gettext.translation("pyLoadCli", join(pypath, "locale"), >- languages=["en", config["language"]]) >+ languages=[config["language"],"en"],fallback=True) > translation.install(unicode=True) > > interactive = False >@@ -515,8 +516,9 @@ > config["port"] = params > elif option in ("-l", "--language"): > config["language"] = params >+ gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) > translation = gettext.translation("pyLoadCli", join(pypath, "locale"), >- languages=["en", config["language"]]) >+ languages=[config["language"],"en"],fallback=True) > translation.install(unicode=True) > elif option in ("-h", "--help"): > print_help(config) >@@ -585,4 +587,4 @@ > > > if __name__ == "__main__": >- main() >\ No newline at end of file >+ main() >diff -r 57b634b1b4d0 pyLoadCore.py >--- a/pyLoadCore.py Fri Dec 02 15:06:51 2011 +0100 >+++ b/pyLoadCore.py Sat Dec 03 19:32:14 2011 +0100 >@@ -25,7 +25,7 @@ > import __builtin__ > > from getopt import getopt, GetoptError >-import gettext >+import module.common.pylgettext as gettext > from imp import find_module > import logging > import logging.handlers >@@ -288,8 +288,9 @@ > > self.config = ConfigParser() > >+ gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) > translation = gettext.translation("pyLoad", self.path("locale"), >- languages=["en", self.config['general']['language']]) >+ languages=[self.config['general']['language'],"en"],fallback=True) > translation.install(True) > > self.debug = self.doDebug or self.config['general']['debug_mode'] >diff -r 57b634b1b4d0 pyLoadGui.py >--- a/pyLoadGui.py Fri Dec 02 15:06:51 2011 +0100 >+++ b/pyLoadGui.py Sat Dec 03 19:32:14 2011 +0100 >@@ -29,7 +29,8 @@ > from PyQt4.QtGui import * > > import re >-import gettext >+import module.common.pylgettext as gettext >+import os > from os.path import abspath > from os.path import join > from os.path import basename >@@ -77,7 +78,8 @@ > parser = XMLParser(join(self.path, "module", "config", "gui_default.xml")) > lang = parser.xml.elementsByTagName("language").item(0).toElement().text() > >- translation = gettext.translation("pyLoadGui", join(pypath, "locale"), languages=["en", str(lang)]) >+ gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) >+ translation = gettext.translation("pyLoadGui", join(pypath, "locale"), languages=[str(lang), "en"], fallback=True) > try: > translation.install(unicode=(True if sys.stdout.encoding.lower().startswith("utf") else False)) > except:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 374871
:
287145
|
287147
|
287149
|
288155
|
288357
|
293449
|
293451
|
293467
|
293567
|
293569
|
293571
|
293573
|
293575
|
293577
|
293579
|
293585
|
293589
|
293871
|
294257
|
294383
|
294429
|
294459
|
294501
| 294627 |
298795
|
298797