Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
ed91e099
Commit
ed91e099
authored
Feb 06, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MoAdd better plural form descriptions (issue #205)
parent
35770d89
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
2 deletions
+61
-2
weblate/lang/models.py
weblate/lang/models.py
+61
-2
No files found.
weblate/lang/models.py
View file @
ed91e099
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#
#
from
django.db
import
models
from
django.db
import
models
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
,
pgettext_lazy
from
django.db.models
import
Sum
from
django.db.models
import
Sum
from
translate.lang
import
data
from
translate.lang
import
data
from
south.signals
import
post_migrate
from
south.signals
import
post_migrate
...
@@ -445,6 +445,60 @@ PLURAL_ONE_FEW_MANY_OTHER = 8
...
@@ -445,6 +445,60 @@ PLURAL_ONE_FEW_MANY_OTHER = 8
PLURAL_TWO_OTHER
=
9
PLURAL_TWO_OTHER
=
9
PLURAL_UNKNOWN
=
666
PLURAL_UNKNOWN
=
666
# Plural names mapping
PLURAL_NAMES
=
{
PLURAL_NONE
:
(
''
,),
PLURAL_ONE_OTHER
:
(
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Plural'
),
),
PLURAL_ONE_FEW_OTHER
:
(
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Few'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
),
PLURAL_ARABIC
:
(
pgettext_lazy
(
'Plural form description'
,
'Zero'
),
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Two'
),
pgettext_lazy
(
'Plural form description'
,
'uFew'
),
pgettext_lazy
(
'Plural form description'
,
'Many'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
),
PLURAL_ONE_TWO_OTHER
:
(
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Two'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
),
PLURAL_ONE_TWO_THREE_OTHER
:
(
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Two'
),
pgettext_lazy
(
'Plural form description'
,
'Three'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
),
PLURAL_ONE_TWO_FEW_OTHER
:
(
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Two'
),
pgettext_lazy
(
'Plural form description'
,
'Few'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
),
PLURAL_ONE_OTHER_ZERO
:
(
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
pgettext_lazy
(
'Plural form description'
,
'Zero'
),
),
PLURAL_ONE_FEW_MANY_OTHER
:
(
pgettext_lazy
(
'Plural form description'
,
'One'
),
pgettext_lazy
(
'Plural form description'
,
'Few'
),
pgettext_lazy
(
'Plural form description'
,
'Many'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
),
PLURAL_TWO_OTHER
:
(
pgettext_lazy
(
'Plural form description'
,
'Two'
),
pgettext_lazy
(
'Plural form description'
,
'Other'
),
),
}
class
Language
(
models
.
Model
):
class
Language
(
models
.
Model
):
PLURAL_CHOICES
=
(
PLURAL_CHOICES
=
(
...
@@ -494,11 +548,16 @@ class Language(models.Model):
...
@@ -494,11 +548,16 @@ class Language(models.Model):
'''
'''
Returns label for plural form.
Returns label for plural form.
'''
'''
if
self
.
plural_type
==
PLURAL_UNKNOWN
:
try
:
return
unicode
(
PLURAL_NAMES
[
self
.
plural_type
][
idx
])
except
:
if
idx
==
0
:
if
idx
==
0
:
return
_
(
'Singular'
)
return
_
(
'Singular'
)
elif
idx
==
0
:
return
_
(
'Plural'
)
return
_
(
'Plural form %d'
)
%
idx
return
_
(
'Plural form %d'
)
%
idx
@
models
.
permalink
@
models
.
permalink
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
(
'weblate.trans.views.show_language'
,
(),
{
return
(
'weblate.trans.views.show_language'
,
(),
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment