fixed path find for pluralization rules

This commit is contained in:
mdipierro
2012-08-30 14:54:40 -05:00
parent 25f349a3a9
commit ec92b8fff1
5 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.0.2 (2012-08-30 14:49:47) stable Version 2.0.2 (2012-08-30 14:54:37) stable
@@ -4,6 +4,7 @@
'!langname!': 'English (US)', '!langname!': 'English (US)',
'%s %%(shop)': '%s %%(shop)', '%s %%(shop)': '%s %%(shop)',
'%s %%(shop[0])': '%s %%(shop[0])', '%s %%(shop[0])': '%s %%(shop[0])',
'%s %%{quark[0]}': '%s %%{quark[0]}',
'%s %%{shop[0]}': '%s %%{shop[0]}', '%s %%{shop[0]}': '%s %%{shop[0]}',
'%s %%{shop}': '%s %%{shop}', '%s %%{shop}': '%s %%{shop}',
'%Y-%m-%d': '%Y-%m-%d', '%Y-%m-%d': '%Y-%m-%d',
@@ -6,6 +6,7 @@
'is': ['are'], 'is': ['are'],
'man': ['men'], 'man': ['men'],
'person': ['people'], 'person': ['people'],
'quark': ['quarks'],
'shop': ['shops'], 'shop': ['shops'],
'this': ['these'], 'this': ['these'],
'was': ['were'], 'was': ['were'],
+4 -2
View File
@@ -18,7 +18,7 @@ import portalocker
import logging import logging
import marshal import marshal
import copy_reg import copy_reg
from fileutils import abspath, listdir from fileutils import listdir
import settings import settings
from cfs import getcfs from cfs import getcfs
from thread import allocate_lock from thread import allocate_lock
@@ -31,6 +31,8 @@ __all__ = ['translator', 'findT', 'update_all_languages']
ospath = os.path ospath = os.path
ostat = os.stat ostat = os.stat
osep = os.sep osep = os.sep
pjoin = os.path.join
pdirname = os.path.dirname
isdir = os.path.isdir isdir = os.path.isdir
is_gae = settings.global_settings.web2py_runtime_gae is_gae = settings.global_settings.web2py_runtime_gae
@@ -244,7 +246,7 @@ def read_possible_plurals():
create list of all possible plural rules files create list of all possible plural rules files
result is cached to increase speed result is cached to increase speed
""" """
pdir = abspath('gluon','contrib','rules') pdir = pjoin(pdirname(__file__),'contrib','rules')
plurals = {} plurals = {}
# scan rules directory for plural_rules-*.py files: # scan rules directory for plural_rules-*.py files:
for pname in os.listdir(pdir): for pname in os.listdir(pdir):
+4
View File
@@ -81,6 +81,10 @@ try:
'1 shop') '1 shop')
self.assertEqual(str(T('%s %%{shop[0]}', 2)), self.assertEqual(str(T('%s %%{shop[0]}', 2)),
'2 shops') '2 shops')
self.assertEqual(str(T('%s %%{quark[0]}', 1)),
'1 quark')
self.assertEqual(str(T('%s %%{quark[0]}', 2)),
'2 quarks')
self.assertEqual(str(T.M('**Hello World**')), self.assertEqual(str(T.M('**Hello World**')),
'<strong>Hello World</strong>') '<strong>Hello World</strong>')
T.force('it') T.force('it')