Replace sample r2.data file with updated version

Based on sister changes to reddit-i18n, r2.data
should be JSON formatted. This is only used when
reddit-i18n translations are not in use (for opensource
clones/staging). In addition, the fallback
I18N_PATH (used when reddit-i18n repo not found)
was incorrect.

Also, remove unused imports in translation.py
This commit is contained in:
Keith Mitchell
2011-12-05 17:17:34 -08:00
parent e6f5a8b138
commit 00f97a47ff
4 changed files with 4 additions and 53 deletions

View File

@@ -44,7 +44,6 @@ from embed import EmbedController
from error import ErrorController
from post import PostController
from toolbar import ToolbarController
from i18n import I18nController
from awards import AwardsController
from ads import AdsController
from usage import UsageController

View File

@@ -1,41 +1 @@
(dp1
S'en_name'
p2
Ven
p3
sS'num_completed'
p4
I457
sS'name'
p5
Ven
p6
sS'plural_names'
p7
(lp8
Vsingular
p9
aVplural
p10
asS'source_trans'
p11
(dp12
sS'_is_enabled'
p13
I00
sS'author'
p14
c__builtin__
set
p15
((ltRp16
sS'enabled'
p17
(dp18
sS'num_total'
p19
I457
sS'nplurals'
p20
I2
s.
{"_is_enabled": true, "en_name": "English", "num_completed": 921, "name": "English", "num_total": 1095}

View File

@@ -27,7 +27,7 @@ try:
import reddit_i18n
I18N_PATH = os.path.dirname(reddit_i18n.__file__)
except ImportError:
I18N_PATH = os.path.abspath('r2/i18n')
I18N_PATH = os.path.abspath('r2/r2/i18n')
def get_available_languages():

View File

@@ -19,21 +19,12 @@
# All portions of the code written by CondeNet are Copyright (c) 2006-2010
# CondeNet, Inc. All Rights Reserved.
################################################################################
from babel import Locale
from datetime import datetime, timedelta
import gettext
from hashlib import md5
import json
import os
import pylons
from pylons.i18n import _
from pylons.i18n.translation import translation, LanguageError, NullTranslations
import random
import re
import time
from r2.lib.i18n import I18N_PATH as _i18n_path
from r2.lib.utils import Storage
_domain = 'r2'
@@ -67,10 +58,11 @@ def set_lang(lang, graceful_fail = False, **kwargs):
def load_data(lang, path=_i18n_path, domain=_domain, extension='data'):
filename = os.path.join(path, locale, 'LC_MESSAGES',
filename = os.path.join(path, lang, 'LC_MESSAGES',
domain + '.' + extension)
with open(filename) as datafile:
data = json.load(datafile)
return data
def get_active_langs(path=_i18n_path, default_lang='en'):