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
4eafb426
Commit
4eafb426
authored
Nov 25, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use immutable tuple instead of mutable aray where possible
parent
08a03e1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
trans/checks/chars.py
trans/checks/chars.py
+23
-23
No files found.
trans/checks/chars.py
View file @
4eafb426
...
@@ -124,22 +124,22 @@ class EndStopCheck(TargetCheck):
...
@@ -124,22 +124,22 @@ class EndStopCheck(TargetCheck):
if
not
target
:
if
not
target
:
return
False
return
False
# Thai does not have a full stop
# Thai does not have a full stop
if
self
.
is_language
(
unit
,
[
'th'
]
):
if
self
.
is_language
(
unit
,
(
'th'
,
)
):
return
False
return
False
if
self
.
is_language
(
unit
,
[
'ja'
])
and
source
[
-
1
]
in
[
':'
,
';'
]
:
if
self
.
is_language
(
unit
,
(
'ja'
,
))
and
source
[
-
1
]
in
(
':'
,
';'
)
:
# Japanese sentence might need to end with full stop
# Japanese sentence might need to end with full stop
# in case it's used before list.
# in case it's used before list.
return
self
.
check_chars
(
return
self
.
check_chars
(
source
,
target
,
-
1
,
[
u';'
,
u':'
,
u':'
,
u'.'
,
u'。'
]
source
,
target
,
-
1
,
(
u';'
,
u':'
,
u':'
,
u'.'
,
u'。'
)
)
)
if
self
.
is_language
(
unit
,
[
'hi'
,
'bn'
]):
if
self
.
is_language
(
unit
,
[
'hi'
,
'bn'
]):
# Using | instead of । is not typographically correct, but
# Using | instead of । is not typographically correct, but
# seems to be quite usual
# seems to be quite usual
return
self
.
check_chars
(
return
self
.
check_chars
(
source
,
target
,
-
1
,
[
u'.'
,
u'।'
,
u'|'
]
source
,
target
,
-
1
,
(
u'.'
,
u'।'
,
u'|'
)
)
)
return
self
.
check_chars
(
return
self
.
check_chars
(
source
,
target
,
-
1
,
[
u'.'
,
u'。'
,
u'।'
,
u'۔'
,
u'։'
,
u'·'
,
u'෴'
]
source
,
target
,
-
1
,
(
u'.'
,
u'。'
,
u'।'
,
u'۔'
,
u'։'
,
u'·'
,
u'෴'
)
)
)
...
@@ -158,7 +158,7 @@ class EndColonCheck(TargetCheck):
...
@@ -158,7 +158,7 @@ class EndColonCheck(TargetCheck):
def
check_single
(
self
,
source
,
target
,
unit
,
cache_slot
):
def
check_single
(
self
,
source
,
target
,
unit
,
cache_slot
):
if
not
source
or
not
target
:
if
not
source
or
not
target
:
return
False
return
False
if
self
.
is_language
(
unit
,
[
'fr'
,
'br'
]
):
if
self
.
is_language
(
unit
,
(
'fr'
,
'br'
)
):
if
source
[
-
1
]
==
':'
:
if
source
[
-
1
]
==
':'
:
# Accept variant with trailing space as well
# Accept variant with trailing space as well
if
target
[
-
1
]
==
' '
:
if
target
[
-
1
]
==
' '
:
...
@@ -168,27 +168,27 @@ class EndColonCheck(TargetCheck):
...
@@ -168,27 +168,27 @@ class EndColonCheck(TargetCheck):
if
check_string
not
in
self
.
colon_fr
:
if
check_string
not
in
self
.
colon_fr
:
return
True
return
True
return
False
return
False
if
self
.
is_language
(
unit
,
[
'hy'
]
):
if
self
.
is_language
(
unit
,
(
'hy'
,
)
):
if
source
[
-
1
]
==
':'
:
if
source
[
-
1
]
==
':'
:
return
self
.
check_chars
(
return
self
.
check_chars
(
source
,
source
,
target
,
target
,
-
1
,
-
1
,
[
u':'
,
u'՝'
,
u'`'
]
(
u':'
,
u'՝'
,
u'`'
)
)
)
return
False
return
False
if
self
.
is_language
(
unit
,
[
'ja'
]
):
if
self
.
is_language
(
unit
,
(
'ja'
,
)
):
# Japanese sentence might need to end with full stop
# Japanese sentence might need to end with full stop
# in case it's used before list.
# in case it's used before list.
if
source
[
-
1
]
in
[
':'
,
';'
]
:
if
source
[
-
1
]
in
(
':'
,
';'
)
:
return
self
.
check_chars
(
return
self
.
check_chars
(
source
,
source
,
target
,
target
,
-
1
,
-
1
,
[
u';'
,
u':'
,
u':'
,
u'.'
,
u'。'
]
(
u';'
,
u':'
,
u':'
,
u'.'
,
u'。'
)
)
)
return
False
return
False
return
self
.
check_chars
(
source
,
target
,
-
1
,
[
u':'
,
u':'
]
)
return
self
.
check_chars
(
source
,
target
,
-
1
,
(
u':'
,
u':'
)
)
class
EndQuestionCheck
(
TargetCheck
):
class
EndQuestionCheck
(
TargetCheck
):
...
@@ -207,21 +207,21 @@ class EndQuestionCheck(TargetCheck):
...
@@ -207,21 +207,21 @@ class EndQuestionCheck(TargetCheck):
def
check_single
(
self
,
source
,
target
,
unit
,
cache_slot
):
def
check_single
(
self
,
source
,
target
,
unit
,
cache_slot
):
if
not
source
or
not
target
:
if
not
source
or
not
target
:
return
False
return
False
if
self
.
is_language
(
unit
,
[
'fr'
,
'br'
]
):
if
self
.
is_language
(
unit
,
(
'fr'
,
'br'
)
):
if
source
[
-
1
]
!=
'?'
:
if
source
[
-
1
]
!=
'?'
:
return
False
return
False
return
target
[
-
2
:]
not
in
self
.
question_fr
return
target
[
-
2
:]
not
in
self
.
question_fr
if
self
.
is_language
(
unit
,
[
'hy'
]
):
if
self
.
is_language
(
unit
,
(
'hy'
,
)
):
if
source
[
-
1
]
==
'?'
:
if
source
[
-
1
]
==
'?'
:
return
self
.
check_chars
(
return
self
.
check_chars
(
source
,
source
,
target
,
target
,
-
1
,
-
1
,
[
u'?'
,
u'՞'
]
(
u'?'
,
u'՞'
)
)
)
return
False
return
False
if
self
.
is_language
(
unit
,
[
'el'
]
):
if
self
.
is_language
(
unit
,
(
'el'
,
)
):
if
source
[
-
1
]
!=
'?'
:
if
source
[
-
1
]
!=
'?'
:
return
False
return
False
return
target
[
-
1
]
not
in
self
.
question_el
return
target
[
-
1
]
not
in
self
.
question_el
...
@@ -230,7 +230,7 @@ class EndQuestionCheck(TargetCheck):
...
@@ -230,7 +230,7 @@ class EndQuestionCheck(TargetCheck):
source
,
source
,
target
,
target
,
-
1
,
-
1
,
[
u'?'
,
u'՞'
,
u'؟'
,
u'⸮'
,
u'?'
,
u'፧'
,
u'꘏'
,
u'⳺'
]
(
u'?'
,
u'՞'
,
u'؟'
,
u'⸮'
,
u'?'
,
u'፧'
,
u'꘏'
,
u'⳺'
)
)
)
...
@@ -249,20 +249,20 @@ class EndExclamationCheck(TargetCheck):
...
@@ -249,20 +249,20 @@ class EndExclamationCheck(TargetCheck):
def
check_single
(
self
,
source
,
target
,
unit
,
cache_slot
):
def
check_single
(
self
,
source
,
target
,
unit
,
cache_slot
):
if
not
source
or
not
target
:
if
not
source
or
not
target
:
return
False
return
False
if
self
.
is_language
(
unit
,
[
'eu'
]
):
if
self
.
is_language
(
unit
,
(
'eu'
,
)
):
if
source
[
-
1
]
==
'!'
:
if
source
[
-
1
]
==
'!'
:
if
u'¡'
in
target
and
u'!'
in
target
:
if
u'¡'
in
target
and
u'!'
in
target
:
return
False
return
False
if
self
.
is_language
(
unit
,
[
'hy'
]
):
if
self
.
is_language
(
unit
,
(
'hy'
,
)
):
if
source
[
-
1
]
==
'!'
:
if
source
[
-
1
]
==
'!'
:
return
self
.
check_chars
(
return
self
.
check_chars
(
source
,
source
,
target
,
target
,
-
1
,
-
1
,
[
u'!'
,
u'՜'
,
u'~'
]
(
u'!'
,
u'՜'
,
u'~'
)
)
)
return
False
return
False
if
self
.
is_language
(
unit
,
[
'fr'
,
'br'
]
):
if
self
.
is_language
(
unit
,
(
'fr'
,
'br'
)
):
if
source
[
-
1
]
==
'!'
:
if
source
[
-
1
]
==
'!'
:
if
target
[
-
2
:]
not
in
self
.
exclamation_fr
:
if
target
[
-
2
:]
not
in
self
.
exclamation_fr
:
return
True
return
True
...
@@ -271,7 +271,7 @@ class EndExclamationCheck(TargetCheck):
...
@@ -271,7 +271,7 @@ class EndExclamationCheck(TargetCheck):
source
,
source
,
target
,
target
,
-
1
,
-
1
,
[
u'!'
,
u'!'
,
u'՜'
,
u'᥄'
,
u'႟'
,
u'߹'
]
(
u'!'
,
u'!'
,
u'՜'
,
u'᥄'
,
u'႟'
,
u'߹'
)
)
)
...
@@ -289,7 +289,7 @@ class EndEllipsisCheck(TargetCheck):
...
@@ -289,7 +289,7 @@ class EndEllipsisCheck(TargetCheck):
# Allow ... to be translated into ellipsis
# Allow ... to be translated into ellipsis
if
source
.
endswith
(
'...'
)
and
target
[
-
1
]
==
u'…'
:
if
source
.
endswith
(
'...'
)
and
target
[
-
1
]
==
u'…'
:
return
False
return
False
return
self
.
check_chars
(
source
,
target
,
-
1
,
[
u'…'
]
)
return
self
.
check_chars
(
source
,
target
,
-
1
,
(
u'…'
,
)
)
class
NewlineCountingCheck
(
CountingCheck
):
class
NewlineCountingCheck
(
CountingCheck
):
...
...
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