summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--locale/cli.pot20
-rw-r--r--locale/core.pot54
-rw-r--r--locale/django.pot2
-rw-r--r--locale/gui.pot22
-rw-r--r--locale/setup.pot246
-rw-r--r--module/common/pylgettext.py62
-rw-r--r--module/setup.py52
-rw-r--r--module/web/webinterface.py6
-rwxr-xr-xpyLoadCli.py10
-rwxr-xr-xpyLoadCore.py5
-rwxr-xr-xpyLoadGui.py6
11 files changed, 301 insertions, 184 deletions
diff --git a/locale/cli.pot b/locale/cli.pot
index 13ff3e5c2..646c6c70e 100644
--- a/locale/cli.pot
+++ b/locale/cli.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pyLoad 0.4.9\n"
"Report-Msgid-Bugs-To: 'bugs@pyload.org'\n"
-"POT-Creation-Date: 2011-12-07 19:00+0100\n"
+"POT-Creation-Date: 2011-12-07 19:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -187,40 +187,40 @@ msgstr ""
msgid "Couldn't write user config file"
msgstr ""
-#: pyLoadCli.py:546
+#: pyLoadCli.py:548
msgid "You need py-openssl to connect to this pyLoad Core."
msgstr ""
-#: pyLoadCli.py:553
+#: pyLoadCli.py:555
msgid "Address: "
msgstr ""
-#: pyLoadCli.py:554
+#: pyLoadCli.py:556
msgid "Port: "
msgstr ""
-#: pyLoadCli.py:555
+#: pyLoadCli.py:557
msgid "Username: "
msgstr ""
-#: pyLoadCli.py:559
+#: pyLoadCli.py:561
msgid "Password: "
msgstr ""
-#: pyLoadCli.py:564 pyLoadCli.py:573
+#: pyLoadCli.py:566 pyLoadCli.py:575
msgid "Login data is wrong."
msgstr ""
-#: pyLoadCli.py:566 pyLoadCli.py:575
+#: pyLoadCli.py:568 pyLoadCli.py:577
#, python-format
msgid "Could not establish connection to %(addr)s:%(port)s."
msgstr ""
-#: pyLoadCli.py:578
+#: pyLoadCli.py:580
msgid "You need py-openssl to connect to this pyLoad core."
msgstr ""
-#: pyLoadCli.py:580
+#: pyLoadCli.py:582
msgid "Interactive mode ignored since you passed some commands."
msgstr ""
diff --git a/locale/core.pot b/locale/core.pot
index 0cdc66476..546f0e4d3 100644
--- a/locale/core.pot
+++ b/locale/core.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pyLoad 0.4.9\n"
"Report-Msgid-Bugs-To: 'bugs@pyload.org'\n"
-"POT-Creation-Date: 2011-12-07 19:00+0100\n"
+"POT-Creation-Date: 2011-12-07 19:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -21,116 +21,116 @@ msgstr ""
msgid "Received Quit signal"
msgstr ""
-#: pyLoadCore.py:300
+#: pyLoadCore.py:301
#, python-format
msgid "pyLoad already running with pid %s"
msgstr ""
-#: pyLoadCore.py:314
+#: pyLoadCore.py:315
#, python-format
msgid "Failed changing group: %s"
msgstr ""
-#: pyLoadCore.py:324
+#: pyLoadCore.py:325
#, python-format
msgid "Failed changing user: %s"
msgstr ""
-#: pyLoadCore.py:326
+#: pyLoadCore.py:327
msgid "folder for logs"
msgstr ""
-#: pyLoadCore.py:337
+#: pyLoadCore.py:338
msgid "Starting"
msgstr ""
-#: pyLoadCore.py:338
+#: pyLoadCore.py:339
#, python-format
msgid "Using home directory: %s"
msgstr ""
-#: pyLoadCore.py:347
+#: pyLoadCore.py:348
msgid "pycrypto to decode container files"
msgstr ""
-#: pyLoadCore.py:350
+#: pyLoadCore.py:351
msgid "folder for temporary files"
msgstr ""
-#: pyLoadCore.py:355
+#: pyLoadCore.py:356
msgid "folder for downloads"
msgstr ""
-#: pyLoadCore.py:358
+#: pyLoadCore.py:359
msgid "OpenSSL for secure connection"
msgstr ""
-#: pyLoadCore.py:362
+#: pyLoadCore.py:363
msgid "Moving old user config to DB"
msgstr ""
-#: pyLoadCore.py:365
+#: pyLoadCore.py:366
msgid "Please check your logindata with ./pyLoadCore.py -u"
msgstr ""
-#: pyLoadCore.py:368
+#: pyLoadCore.py:369
msgid "All links removed"
msgstr ""
-#: pyLoadCore.py:399
+#: pyLoadCore.py:400
#, python-format
msgid "Downloadtime: %s"
msgstr ""
-#: pyLoadCore.py:409
+#: pyLoadCore.py:410
#, python-format
msgid "Free space: %s"
msgstr ""
-#: pyLoadCore.py:429
+#: pyLoadCore.py:430
msgid "Activating Accounts..."
msgstr ""
-#: pyLoadCore.py:435
+#: pyLoadCore.py:436
msgid "Activating Plugins..."
msgstr ""
-#: pyLoadCore.py:438
+#: pyLoadCore.py:439
msgid "pyLoad is up and running"
msgstr ""
-#: pyLoadCore.py:457
+#: pyLoadCore.py:458
msgid "restarting pyLoad"
msgstr ""
-#: pyLoadCore.py:461
+#: pyLoadCore.py:462
msgid "pyLoad quits"
msgstr ""
-#: pyLoadCore.py:518
+#: pyLoadCore.py:519
#, python-format
msgid "Install %s"
msgstr ""
-#: pyLoadCore.py:554
+#: pyLoadCore.py:555
#, python-format
msgid "could not find %(desc)s: %(name)s"
msgstr ""
-#: pyLoadCore.py:556
+#: pyLoadCore.py:557
#, python-format
msgid "could not create %(desc)s: %(name)s"
msgstr ""
-#: pyLoadCore.py:577
+#: pyLoadCore.py:578
msgid "shutting down..."
msgstr ""
-#: pyLoadCore.py:594
+#: pyLoadCore.py:595
msgid "error while shutting down"
msgstr ""
-#: pyLoadCore.py:658
+#: pyLoadCore.py:659
msgid "killed pyLoad from Terminal"
msgstr ""
diff --git a/locale/django.pot b/locale/django.pot
index ba34f70c5..81c9c7b6b 100644
--- a/locale/django.pot
+++ b/locale/django.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pyLoad 0.4.9\n"
"Report-Msgid-Bugs-To: 'bugs@pyload.org'\n"
-"POT-Creation-Date: 2011-12-07 19:00+0100\n"
+"POT-Creation-Date: 2011-12-07 19:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/locale/gui.pot b/locale/gui.pot
index f8a56e738..dc74397a0 100644
--- a/locale/gui.pot
+++ b/locale/gui.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pyLoad 0.4.9\n"
"Report-Msgid-Bugs-To: 'bugs@pyload.org'\n"
-"POT-Creation-Date: 2011-12-07 19:00+0100\n"
+"POT-Creation-Date: 2011-12-07 19:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,46 +17,46 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: pyLoadGui.py:288
+#: pyLoadGui.py:290
msgid "paused"
msgstr ""
-#: pyLoadGui.py:290
+#: pyLoadGui.py:292
msgid "running"
msgstr ""
-#: pyLoadGui.py:330
+#: pyLoadGui.py:332
msgid "Unnamed"
msgstr ""
-#: pyLoadGui.py:653
+#: pyLoadGui.py:655
#, python-format
msgid "Finished downloading of '%s'"
msgstr ""
-#: pyLoadGui.py:655
+#: pyLoadGui.py:657
#, python-format
msgid "Failed downloading '%s'!"
msgstr ""
-#: pyLoadGui.py:658
+#: pyLoadGui.py:660
#, python-format
msgid "Added '%s' to queue"
msgstr ""
-#: pyLoadGui.py:683
+#: pyLoadGui.py:685
msgid "Connection lost"
msgstr ""
-#: pyLoadGui.py:683
+#: pyLoadGui.py:685
msgid "Lost connection to the core!"
msgstr ""
-#: pyLoadGui.py:718
+#: pyLoadGui.py:720
msgid "Show"
msgstr ""
-#: pyLoadGui.py:723 module/gui/MainWindow.py:133
+#: pyLoadGui.py:725 module/gui/MainWindow.py:133
msgid "Exit"
msgstr ""
diff --git a/locale/setup.pot b/locale/setup.pot
index fdf465201..cf4dd8cfc 100644
--- a/locale/setup.pot
+++ b/locale/setup.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pyLoad 0.4.9\n"
"Report-Msgid-Bugs-To: 'bugs@pyload.org'\n"
-"POT-Creation-Date: 2011-12-07 19:00+0100\n"
+"POT-Creation-Date: 2011-12-07 19:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,439 +17,479 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: module/setup.py:67
+#: module/setup.py:51
+msgid "y"
+msgstr ""
+
+#: module/setup.py:53
+msgid "n"
+msgstr ""
+
+#: module/setup.py:72
msgid "Welcome to the pyLoad Configuration Assistent."
msgstr ""
-#: module/setup.py:68
+#: module/setup.py:73
msgid ""
"It will check your system and make a basic setup in order to run pyLoad."
msgstr ""
-#: module/setup.py:70
+#: module/setup.py:75
msgid "The value in brackets [] always is the default value,"
msgstr ""
-#: module/setup.py:71
+#: module/setup.py:76
msgid ""
"in case you don't want to change it or you are unsure what to choose, just "
"hit enter."
msgstr ""
-#: module/setup.py:72
+#: module/setup.py:77
msgid ""
"Don't forget: You can always rerun this assistent with --setup or -s "
"parameter, when you start pyLoadCore."
msgstr ""
-#: module/setup.py:73
+#: module/setup.py:78
msgid "If you have any problems with this assistent hit STRG-C,"
msgstr ""
-#: module/setup.py:74
+#: module/setup.py:79
msgid "to abort and don't let him start with pyLoadCore automatically anymore."
msgstr ""
-#: module/setup.py:76
+#: module/setup.py:81
msgid "When you are ready for system check, hit enter."
msgstr ""
-#: module/setup.py:83
+#: module/setup.py:88
msgid "You need pycurl, sqlite and python 2.5, 2.6 or 2.7 to run pyLoad."
msgstr ""
-#: module/setup.py:84
+#: module/setup.py:89
msgid "Please correct this and re-run pyLoad."
msgstr ""
-#: module/setup.py:85
+#: module/setup.py:90
msgid "Setup will now close."
msgstr ""
-#: module/setup.py:89
+#: module/setup.py:94
msgid "System check finished, hit enter to see your status report."
msgstr ""
-#: module/setup.py:91
+#: module/setup.py:96
msgid "## Status ##"
msgstr ""
-#: module/setup.py:96
+#: module/setup.py:101
msgid "container decrypting"
msgstr ""
-#: module/setup.py:97
+#: module/setup.py:102
msgid "ssl connection"
msgstr ""
-#: module/setup.py:98
+#: module/setup.py:103
msgid "automatic captcha decryption"
msgstr ""
-#: module/setup.py:99
+#: module/setup.py:104
msgid "GUI"
msgstr ""
-#: module/setup.py:100
+#: module/setup.py:105
msgid "Webinterface"
msgstr ""
-#: module/setup.py:101
+#: module/setup.py:106
msgid "extended Click'N'Load"
msgstr ""
-#: module/setup.py:108
+#: module/setup.py:113
msgid "Features available:"
msgstr ""
-#: module/setup.py:112
+#: module/setup.py:117
msgid "Featues missing: "
msgstr ""
-#: module/setup.py:116
+#: module/setup.py:121
msgid "no py-crypto available"
msgstr ""
-#: module/setup.py:117
+#: module/setup.py:122
msgid "You need this if you want to decrypt container files."
msgstr ""
-#: module/setup.py:121
+#: module/setup.py:126
msgid "no SSL available"
msgstr ""
-#: module/setup.py:122
+#: module/setup.py:127
msgid ""
"This is needed if you want to establish a secure connection to core or "
"webinterface."
msgstr ""
-#: module/setup.py:123
+#: module/setup.py:128
msgid "If you only want to access locally to pyLoad ssl is not usefull."
msgstr ""
-#: module/setup.py:127
+#: module/setup.py:132
msgid "no Captcha Recognition available"
msgstr ""
-#: module/setup.py:128
+#: module/setup.py:133
msgid "Only needed for some hosters and as freeuser."
msgstr ""
-#: module/setup.py:132
+#: module/setup.py:137
msgid "Gui not available"
msgstr ""
-#: module/setup.py:133
+#: module/setup.py:138
msgid "The Graphical User Interface."
msgstr ""
-#: module/setup.py:137
+#: module/setup.py:142
msgid "no JavaScript engine found"
msgstr ""
-#: module/setup.py:138
+#: module/setup.py:143
msgid ""
"You will need this for some Click'N'Load links. Install Spidermonkey, ossp-"
"js, pyv8 or rhino"
msgstr ""
-#: module/setup.py:140
+#: module/setup.py:145
msgid "You can abort the setup now and fix some dependicies if you want."
msgstr ""
-#: module/setup.py:142
+#: module/setup.py:147
msgid "Continue with setup?"
msgstr ""
-#: module/setup.py:148
+#: module/setup.py:153
#, python-format
msgid "Do you want to change the config path? Current is %s"
msgstr ""
-#: module/setup.py:149
+#: module/setup.py:154
msgid ""
"If you use pyLoad on a server or the home partition lives on an iternal "
"flash it may be a good idea to change it."
msgstr ""
-#: module/setup.py:150
+#: module/setup.py:155
msgid "Change config path?"
msgstr ""
-#: module/setup.py:157
+#: module/setup.py:162
msgid "Do you want to configure login data and basic settings?"
msgstr ""
-#: module/setup.py:158
+#: module/setup.py:163
msgid "This is recommend for first run."
msgstr ""
-#: module/setup.py:159
+#: module/setup.py:164
msgid "Make basic setup?"
msgstr ""
-#: module/setup.py:166
+#: module/setup.py:171
msgid "Do you want to configure ssl?"
msgstr ""
-#: module/setup.py:167
+#: module/setup.py:172
msgid "Configure ssl?"
msgstr ""
-#: module/setup.py:173
+#: module/setup.py:178
msgid "Do you want to configure webinterface?"
msgstr ""
-#: module/setup.py:174
+#: module/setup.py:179
msgid "Configure webinterface?"
msgstr ""
-#: module/setup.py:179
+#: module/setup.py:184
msgid "Setup finished successfully."
msgstr ""
-#: module/setup.py:180
+#: module/setup.py:185
msgid "Hit enter to exit and restart pyLoad"
msgstr ""
-#: module/setup.py:186
+#: module/setup.py:191
msgid "## System Check ##"
msgstr ""
-#: module/setup.py:191
+#: module/setup.py:196
msgid "Your python version is to new, Please use Python 2.6/2.7"
msgstr ""
-#: module/setup.py:194
+#: module/setup.py:199
msgid "Your python version is to old, Please use at least Python 2.5"
msgstr ""
-#: module/setup.py:197
+#: module/setup.py:202
msgid "Python Version: OK"
msgstr ""
-#: module/setup.py:244
+#: module/setup.py:249
#, python-format
msgid "Your installed jinja2 version %s seems too old."
msgstr ""
-#: module/setup.py:245
+#: module/setup.py:250
msgid "You can safely continue but if the webinterface is not working,"
msgstr ""
-#: module/setup.py:246
+#: module/setup.py:251
msgid ""
"please upgrade or deinstall it, pyLoad includes a sufficient jinja2 libary."
msgstr ""
-#: module/setup.py:263
+#: module/setup.py:268
msgid "JS engine"
msgstr ""
-#: module/setup.py:269
+#: module/setup.py:274
msgid "## Basic Setup ##"
msgstr ""
-#: module/setup.py:272
+#: module/setup.py:277
msgid "The following logindata is valid for CLI, GUI and webinterface."
msgstr ""
-#: module/setup.py:277 module/setup.py:366 module/setup.py:382
+#: module/setup.py:282 module/setup.py:371 module/setup.py:387
msgid "Username"
msgstr ""
-#: module/setup.py:283
+#: module/setup.py:288
msgid ""
"External clients (GUI, CLI or other) need remote access to work over the "
"network."
msgstr ""
-#: module/setup.py:284
+#: module/setup.py:289
msgid ""
"However, if you only want to use the webinterface you may disable it to save "
"ram."
msgstr ""
-#: module/setup.py:285
+#: module/setup.py:290
msgid "Enable remote access"
msgstr ""
-#: module/setup.py:290
+#: module/setup.py:295
msgid "Language"
msgstr ""
-#: module/setup.py:293
+#: module/setup.py:298
msgid "Downloadfolder"
msgstr ""
-#: module/setup.py:294
+#: module/setup.py:299
msgid "Max parallel downloads"
msgstr ""
-#: module/setup.py:298
+#: module/setup.py:303
msgid "Use Reconnect?"
msgstr ""
-#: module/setup.py:301
+#: module/setup.py:306
msgid "Reconnect script location"
msgstr ""
-#: module/setup.py:306
+#: module/setup.py:311
msgid "## Webinterface Setup ##"
msgstr ""
-#: module/setup.py:309
+#: module/setup.py:314
msgid "Activate webinterface?"
msgstr ""
-#: module/setup.py:311
+#: module/setup.py:316
msgid ""
"Listen address, if you use 127.0.0.1 or localhost, the webinterface will "
"only accessible locally."
msgstr ""
-#: module/setup.py:312
+#: module/setup.py:317
msgid "Address"
msgstr ""
-#: module/setup.py:313
+#: module/setup.py:318
msgid "Port"
msgstr ""
-#: module/setup.py:315
+#: module/setup.py:320
msgid ""
"pyLoad offers several server backends, now following a short explanation."
msgstr ""
-#: module/setup.py:316
+#: module/setup.py:321
msgid "Default server, best choice if you dont know which one to choose."
msgstr ""
-#: module/setup.py:317
+#: module/setup.py:322
msgid "This server offers SSL and is a good alternative to builtin."
msgstr ""
-#: module/setup.py:318
+#: module/setup.py:323
msgid ""
"Can be used by apache, lighttpd, requires you to configure them, which is "
"not too easy job."
msgstr ""
-#: module/setup.py:319
+#: module/setup.py:324
msgid "Very fast alternative written in C, requires libev and linux knowlegde."
msgstr ""
-#: module/setup.py:320
+#: module/setup.py:325
msgid "Get it from here: https://github.com/jonashaag/bjoern, compile it"
msgstr ""
-#: module/setup.py:321
+#: module/setup.py:326
msgid "and copy bjoern.so to module/lib"
msgstr ""
-#: module/setup.py:324
+#: module/setup.py:329
msgid ""
"Attention: In some rare cases the builtin server is not working, if you "
"notice problems with the webinterface"
msgstr ""
-#: module/setup.py:325
+#: module/setup.py:330
msgid "come back here and change the builtin server to the threaded one here."
msgstr ""
-#: module/setup.py:328
+#: module/setup.py:333
msgid "Server"
msgstr ""
-#: module/setup.py:332
+#: module/setup.py:337
msgid "## SSL Setup ##"
msgstr ""
-#: module/setup.py:334
+#: module/setup.py:339
msgid ""
"Execute these commands from pyLoad config folder to make ssl certificates:"
msgstr ""
-#: module/setup.py:340
+#: module/setup.py:345
msgid "If you're done and everything went fine, you can activate ssl now."
msgstr ""
-#: module/setup.py:342
+#: module/setup.py:347
msgid "Activate SSL?"
msgstr ""
-#: module/setup.py:356
+#: module/setup.py:361
msgid "Select action"
msgstr ""
-#: module/setup.py:357
+#: module/setup.py:362
msgid "1 - Create/Edit user"
msgstr ""
-#: module/setup.py:358
+#: module/setup.py:363
msgid "2 - List users"
msgstr ""
-#: module/setup.py:359
+#: module/setup.py:364
msgid "3 - Remove user"
msgstr ""
-#: module/setup.py:360
+#: module/setup.py:365
msgid "4 - Quit"
msgstr ""
-#: module/setup.py:372
+#: module/setup.py:377
msgid "Users"
msgstr ""
-#: module/setup.py:400
+#: module/setup.py:406
msgid "Setting new configpath, current configuration will not be transfered!"
msgstr ""
-#: module/setup.py:401
+#: module/setup.py:407
msgid "Configpath"
msgstr ""
-#: module/setup.py:409
+#: module/setup.py:415
msgid "Configpath changed, setup will now close, please restart to go on."
msgstr ""
-#: module/setup.py:410
+#: module/setup.py:416
msgid "Press Enter to exit."
msgstr ""
-#: module/setup.py:414
+#: module/setup.py:420
#, python-format
msgid "Setting config path failed: %s"
msgstr ""
-#: module/setup.py:419
+#: module/setup.py:425
#, python-format
msgid "%s: OK"
msgstr ""
-#: module/setup.py:421
+#: module/setup.py:427
#, python-format
msgid "%s: missing"
msgstr ""
-#: module/setup.py:464
+#: module/setup.py:456
+msgid "[y]/n"
+msgstr ""
+
+#: module/setup.py:458
+msgid "y/[n]"
+msgstr ""
+
+#: module/setup.py:470
msgid "Password: "
msgstr ""
-#: module/setup.py:469
+#: module/setup.py:475
msgid "Password to short. Use at least 4 symbols."
msgstr ""
-#: module/setup.py:475
+#: module/setup.py:481
msgid "Password (again): "
msgstr ""
-#: module/setup.py:482
+#: module/setup.py:488
msgid "Passwords did not match."
msgstr ""
-#: module/setup.py:497 module/setup.py:508
+#: module/setup.py:499
+msgid "yes"
+msgstr ""
+
+#: module/setup.py:499
+msgid "true"
+msgstr ""
+
+#: module/setup.py:499
+msgid "t"
+msgstr ""
+
+#: module/setup.py:502
+msgid "no"
+msgstr ""
+
+#: module/setup.py:502
+msgid "false"
+msgstr ""
+
+#: module/setup.py:502
+msgid "f"
+msgstr ""
+
+#: module/setup.py:505 module/setup.py:516
msgid "Invalid Input"
msgstr ""
diff --git a/module/common/pylgettext.py b/module/common/pylgettext.py
new file mode 100644
index 000000000..ae6d39325
--- /dev/null
+++ b/module/common/pylgettext.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+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):
+ if _searchdirs is None:
+ return origfind(domain, localedir, languages, all)
+ searches = [localedir] + _searchdirs
+ 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 --git a/module/setup.py b/module/setup.py
index 4a1c59da6..2f6963db9 100644
--- a/module/setup.py
+++ b/module/setup.py
@@ -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
@@ -39,14 +39,19 @@ class Setup():
self.path = path
self.config = config
-
def start(self):
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)
+ #Input shorthand for yes
+ self.yes=_("y")
+ #Input shorthand for no
+ self.no=_("n")
+
# print ""
# print _("Would you like to configure pyLoad via Webinterface?")
# print _("You need a Browser and a connection to this PC for it.")
@@ -139,15 +144,15 @@ class Setup():
print _("You can abort the setup now and fix some dependicies if you want.")
- con = self.ask(_("Continue with setup?"), "y", bool=True)
+ con = self.ask(_("Continue with setup?"), self.yes, bool=True)
if not con:
return False
print ""
- print _("Do you want to change the config path? Current is %s" % abspath(""))
+ print _("Do you want to change the config path? Current is %s") % abspath("")
print _("If you use pyLoad on a server or the home partition lives on an iternal flash it may be a good idea to change it.")
- path = self.ask(_("Change config path?"), "n", bool=True)
+ path = self.ask(_("Change config path?"), self.no , bool=True)
if path:
self.conf_path()
#calls exit when changed
@@ -156,7 +161,7 @@ class Setup():
print ""
print _("Do you want to configure login data and basic settings?")
print _("This is recommend for first run.")
- con = self.ask(_("Make basic setup?"), "y", bool=True)
+ con = self.ask(_("Make basic setup?"), self.yes, bool=True)
if con:
self.conf_basic()
@@ -164,14 +169,14 @@ class Setup():
if ssl:
print ""
print _("Do you want to configure ssl?")
- ssl = self.ask(_("Configure ssl?"), "n", bool=True)
+ ssl = self.ask(_("Configure ssl?"), self.no, bool=True)
if ssl:
self.conf_ssl()
if web:
print ""
print _("Do you want to configure webinterface?")
- web = self.ask(_("Configure webinterface?"), "y", bool=True)
+ web = self.ask(_("Configure webinterface?"), self.yes, bool=True)
if web:
self.conf_web()
@@ -282,7 +287,7 @@ class Setup():
print ""
print _("External clients (GUI, CLI or other) need remote access to work over the network.")
print _("However, if you only want to use the webinterface you may disable it to save ram.")
- self.config["remote"]["activated"] = self.ask(_("Enable remote access"), "y", bool=True)
+ self.config["remote"]["activated"] = self.ask(_("Enable remote access"), self.yes, bool=True)
print ""
@@ -295,7 +300,7 @@ class Setup():
#print _("You should disable checksum proofing, if you have low hardware requirements.")
#self.config["general"]["checksum"] = self.ask(_("Proof checksum?"), "y", bool=True)
- reconnect = self.ask(_("Use Reconnect?"), "n", bool=True)
+ reconnect = self.ask(_("Use Reconnect?"), self.no, bool=True)
self.config["reconnect"]["activated"] = reconnect
if reconnect:
self.config["reconnect"]["method"] = self.ask(_("Reconnect script location"), "./reconnect.sh")
@@ -306,7 +311,7 @@ class Setup():
print _("## Webinterface Setup ##")
print ""
- self.config["webinterface"]["activated"] = self.ask(_("Activate webinterface?"), "y", bool=True)
+ self.config["webinterface"]["activated"] = self.ask(_("Activate webinterface?"), self.yes, bool=True)
print ""
print _("Listen address, if you use 127.0.0.1 or localhost, the webinterface will only accessible locally.")
self.config["webinterface"]["host"] = self.ask(_("Address"), "0.0.0.0")
@@ -339,11 +344,11 @@ class Setup():
print ""
print _("If you're done and everything went fine, you can activate ssl now.")
- self.config["ssl"]["activated"] = self.ask(_("Activate SSL?"), "y", bool=True)
+ self.config["ssl"]["activated"] = self.ask(_("Activate SSL?"), self.yes, 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 +399,8 @@ class Setup():
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!")
@@ -446,10 +452,10 @@ class Setup():
info += ")"
elif bool:
- if default == "y":
- info = "([y]/n)"
+ if default == self.yes:
+ info = _("[y]/n")
else:
- info = "(y/[n])"
+ info = _("y/[n]")
else:
info = "[%s]" % default
@@ -489,9 +495,11 @@ class Setup():
input = default
if bool:
- if re.match(r"(y|yes|j|ja|true)", input.lower().strip()):
- return True
- elif re.match(r"(n|no|nein|false)", input.lower().strip()):
+ # yes, true,t are inputs for booleans with value true
+ if input.lower().strip() in [self.yes, _("yes"), _("true"), _("t")]:
+ return True
+ # no, false,f are inputs for booleans with value false
+ elif input.lower().strip() in [self.no, _("no"), _("false"), _("f")]:
return False
else:
print _("Invalid Input")
diff --git a/module/web/webinterface.py b/module/web/webinterface.py
index 68724e3f6..ec8b2e56c 100644
--- a/module/web/webinterface.py
+++ b/module/web/webinterface.py
@@ -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 @@ if PREFIX:
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 --git a/pyLoadCli.py b/pyLoadCli.py
index c992914a7..079cee19c 100755
--- a/pyLoadCli.py
+++ b/pyLoadCli.py
@@ -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 @@ def main():
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 @@ def main():
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 @@ def main():
if __name__ == "__main__":
- main() \ No newline at end of file
+ main()
diff --git a/pyLoadCore.py b/pyLoadCore.py
index cbc270036..99d8642bd 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -25,7 +25,7 @@ CURRENT_VERSION = '0.4.8'
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 @@ class Core(object):
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 --git a/pyLoadGui.py b/pyLoadGui.py
index b8dd6995d..5f620e52a 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -29,7 +29,8 @@ from PyQt4.QtCore import *
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 @@ class main(QObject):
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: