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
dbeb7848
Commit
dbeb7848
authored
Nov 27, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly handle plurals for Qt TS files
Fixes #418
parent
301d15f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
trans/formats.py
trans/formats.py
+11
-1
trans/tests/test_models.py
trans/tests/test_models.py
+13
-1
No files found.
trans/formats.py
View file @
dbeb7848
...
@@ -26,9 +26,10 @@ from translate.storage.properties import propunit, propfile
...
@@ -26,9 +26,10 @@ from translate.storage.properties import propunit, propfile
from
translate.storage.xliff
import
xliffunit
from
translate.storage.xliff
import
xliffunit
from
translate.storage.po
import
pounit
,
pofile
from
translate.storage.po
import
pounit
,
pofile
from
translate.storage.php
import
phpunit
from
translate.storage.php
import
phpunit
from
translate.storage.ts2
import
tsunit
from
translate.storage
import
mo
from
translate.storage
import
mo
from
translate.storage
import
factory
from
translate.storage
import
factory
from
trans.util
import
get_string
from
trans.util
import
get_string
,
join_plural
from
translate.misc
import
quote
from
translate.misc
import
quote
import
weblate
import
weblate
import
subprocess
import
subprocess
...
@@ -142,6 +143,15 @@ class FileUnit(object):
...
@@ -142,6 +143,15 @@ class FileUnit(object):
'''
'''
Returns source string from a ttkit unit.
Returns source string from a ttkit unit.
'''
'''
if
(
isinstance
(
self
.
mainunit
,
tsunit
)
and
self
.
template
is
None
and
self
.
mainunit
.
hasplural
()):
# Need to apply special magic for plurals here
# as there is no singlular/plural in the source string
return
join_plural
([
self
.
unit
.
source
.
replace
(
'(s)'
,
''
),
self
.
unit
.
source
.
replace
(
'(s)'
,
's'
),
])
if
self
.
is_unit_key_value
():
if
self
.
is_unit_key_value
():
# Need to decode property encoded string
# Need to decode property encoded string
if
isinstance
(
self
.
mainunit
,
propunit
):
if
isinstance
(
self
.
mainunit
,
propunit
):
...
...
trans/tests/test_models.py
View file @
dbeb7848
...
@@ -30,7 +30,7 @@ from django.core.exceptions import ValidationError
...
@@ -30,7 +30,7 @@ from django.core.exceptions import ValidationError
import
shutil
import
shutil
import
os
import
os
import
git
import
git
from
trans.models
import
Project
,
SubProject
from
trans.models
import
Project
,
SubProject
,
Unit
from
weblate
import
appsettings
from
weblate
import
appsettings
from
trans.tests.test_util
import
get_test_file
from
trans.tests.test_util
import
get_test_file
...
@@ -147,6 +147,12 @@ class RepoTestCase(TestCase):
...
@@ -147,6 +147,12 @@ class RepoTestCase(TestCase):
'po-mono/en.po'
,
'po-mono/en.po'
,
)
)
def
create_ts
(
self
):
return
self
.
_create_subproject
(
'ts'
,
'ts/*.ts'
,
)
def
create_iphone
(
self
):
def
create_iphone
(
self
):
return
self
.
_create_subproject
(
return
self
.
_create_subproject
(
'strings'
,
'strings'
,
...
@@ -348,6 +354,12 @@ class SubProjectTest(RepoTestCase):
...
@@ -348,6 +354,12 @@ class SubProjectTest(RepoTestCase):
project
=
self
.
create_iphone
()
project
=
self
.
create_iphone
()
self
.
verify_subproject
(
project
,
1
,
'cs'
,
4
)
self
.
verify_subproject
(
project
,
1
,
'cs'
,
4
)
def
test_create_ts
(
self
):
project
=
self
.
create_ts
()
self
.
verify_subproject
(
project
,
1
,
'cs'
,
4
,
'Hello, world!'
)
unit
=
Unit
.
objects
.
get
(
source__startswith
=
'Orangutan'
)
self
.
assertTrue
(
unit
.
is_plural
)
def
test_create_po_pot
(
self
):
def
test_create_po_pot
(
self
):
project
=
self
.
_create_subproject
(
project
=
self
.
_create_subproject
(
'po'
,
'po'
,
...
...
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