16 Commits

Author SHA1 Message Date
Christopher Allan Webber
a808364e7f Fixing translations stuff for command line tools and such.
We had switched mg_globals to have the default translations set to
None so that it would be set up by the mediagoblin app later.
However, this would mean that things like scripts would try to call
gettext and error out.

Thanks to Tumulte for catching this.

This commit sponsored by Aurimas Fišeras.  Thank you!
2013-02-27 13:25:42 -06:00
Sebastian Spaeth
bc142abc55 RIP out mongo
Since sqlalchemy is providing our database abstraction and we have
moved away from Mongo as the underlying database, it is now time to
simplify things and rip out mongo. This provides the bulk of the
changes, and can stand on its own. There are some followup tasks
that can be done, such as removing now unneeded abstraction layers,
e.g. db.sql.fake.py
2012-12-25 20:06:03 +01:00
Sebastian Spaeth
826919c97c en_US is always available
We were using "en" as fallback only when no preferred language matched.
This is obviously bad. Always insert en_US as available locale, so we
can match it with the accept_languages.

Don't set available_locales as mg_global, per discussion with paroneaya,
make it a global var in translate.py

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-02 02:46:50 +01:00
Sebastian Spaeth
6ef75af50e Honor user's browser language (#558)
Previously we would attempt to satisfy the user's first language
preference, immediately falling back to english if that was not
possible. Now, we will get the best match of the user's preferred
languages.

This requires storing the available locales on app startup, so we
have mg_globals.available_locales ready to compare them against the
list of preferred user languages.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-02 00:29:30 +01:00
Sebastian Spaeth
7b9f9d1edb Fix i18n in our browser
We only ever served english pages since the switch to werkzeug's requests.
Fix this by actually checking the accepted languages that our web browser
sends and using that or falling back to english.

This is not optimal, imaging our browser sends "klingon, de" as accepted
languages and we happen to not have a klingon translation ready (a deficiency
that should be corrected immediately anyway!!). We would then fall back
to english rather than sending the sensible and pleasant German language
which the user would understand. This will require more backend work though.

Removing the gettext.find() in mg_globals.py. It looked in the wrong directory
anyway (mediagoblin/translations) and as that does not exist, had always returned
None without anyone noticing.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-01 23:40:10 +01:00
Jakob Kramer
c80982c7a0 make mg_globals.translations thread-safe
I added mg_globals.thread_scope (an instance of threading.local)
and made `translations' an attribute of it.
2012-07-18 19:25:53 +02:00
Christopher Allan Webber
cf29e8a824 It's 2012 all up in here 2012-02-02 09:44:13 -06:00
Christopher Allan Webber
273227e399 Merge branch 'i507_beaker_cache' 2011-09-05 23:28:41 -05:00
Will Kahn-Greene
12a100e4d8 508. Updates copyright/license information 2011-09-01 20:50:19 -04:00
Christopher Allan Webber
0533f117a9 Basic beaker caching functionality added to the application. 2011-08-23 23:22:17 -05:00
Will Kahn-Greene
fc3dc25541 Adds license header 2011-07-30 08:39:07 -04:00
Deb
6ae8b541f9 removed email variables from globals module 2011-07-12 21:21:35 -04:00
Christopher Allan Webber
68bf5b1942 Documenting the setup_globals function. 2011-06-19 16:24:31 -05:00
Christopher Allan Webber
218b8124ca Document our new global objects added during the configobj branch 2011-06-19 16:23:17 -05:00
Christopher Allan Webber
d802498a2c Merge remote branch 'remotes/elrond/idea/globals_check'
Conflicts:
	mediagoblin/tests/test_globals.py
2011-06-19 16:22:41 -05:00
Christopher Allan Webber
6e7ce8d1af mediagoblin.globals->mediagoblin.mg_globals 2011-06-12 17:27:37 -05:00