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
b50a07d1
Commit
b50a07d1
authored
Dec 13, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various coding style improvements
parent
e308d21e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
weblate/trans/checks.py
weblate/trans/checks.py
+13
-9
No files found.
weblate/trans/checks.py
View file @
b50a07d1
...
@@ -142,7 +142,8 @@ SAME_BLACKLIST = frozenset((
...
@@ -142,7 +142,8 @@ SAME_BLACKLIST = frozenset((
'www'
,
'www'
,
'xml'
,
'xml'
,
'zip'
,
'zip'
,
))
)
)
DEFAULT_CHECK_LIST
=
(
DEFAULT_CHECK_LIST
=
(
'weblate.trans.checks.SameCheck'
,
'weblate.trans.checks.SameCheck'
,
...
@@ -215,9 +216,12 @@ class Check(object):
...
@@ -215,9 +216,12 @@ class Check(object):
'''
'''
if
len
(
target
)
==
0
or
len
(
source
)
==
0
:
if
len
(
target
)
==
0
or
len
(
source
)
==
0
:
return
False
return
False
s
=
source
[
pos
]
src
=
source
[
pos
]
t
=
target
[
pos
]
tgt
=
target
[
pos
]
return
(
s
in
chars
and
t
not
in
chars
)
or
(
s
not
in
chars
and
t
in
chars
)
return
(
(
src
in
chars
and
tgt
not
in
chars
)
or
(
src
not
in
chars
and
tgt
in
chars
)
)
def
check_format_strings
(
self
,
source
,
target
,
regex
,
unit
):
def
check_format_strings
(
self
,
source
,
target
,
regex
,
unit
):
'''
'''
...
@@ -255,7 +259,10 @@ class Check(object):
...
@@ -255,7 +259,10 @@ class Check(object):
'''
'''
Returns link to documentation.
Returns link to documentation.
'''
'''
return
weblate
.
get_doc_url
(
'usage'
,
'check-%s'
%
self
.
check_id
.
replace
(
'_'
,
'-'
))
return
weblate
.
get_doc_url
(
'usage'
,
'check-%s'
%
self
.
check_id
.
replace
(
'_'
,
'-'
)
)
def
get_cache_key
(
self
,
unit
):
def
get_cache_key
(
self
,
unit
):
'''
'''
...
@@ -283,13 +290,11 @@ class TargetCheck(Check):
...
@@ -283,13 +290,11 @@ class TargetCheck(Check):
target
=
True
target
=
True
class
SourceCheck
(
Check
):
class
SourceCheck
(
Check
):
'''
'''
Basic class for source checks.
Basic class for source checks.
'''
'''
source
=
True
source
=
True
class
SameCheck
(
TargetCheck
):
class
SameCheck
(
TargetCheck
):
...
@@ -309,7 +314,6 @@ class SameCheck(TargetCheck):
...
@@ -309,7 +314,6 @@ class SameCheck(TargetCheck):
stripped
=
regex
.
sub
(
''
,
msg
)
stripped
=
regex
.
sub
(
''
,
msg
)
return
stripped
.
strip
(
' ,./<>?;
\
'
\
\
:"|[]{}`~!@#$%^&*()-=_+'
)
==
''
return
stripped
.
strip
(
' ,./<>?;
\
'
\
\
:"|[]{}`~!@#$%^&*()-=_+'
)
==
''
def
check_single
(
self
,
source
,
target
,
flags
,
language
,
unit
):
def
check_single
(
self
,
source
,
target
,
flags
,
language
,
unit
):
# Ignore strings which don't contain any string to translate
# Ignore strings which don't contain any string to translate
if
'python-format'
in
flags
and
self
.
is_format_only
(
source
,
PYTHON_PRINTF_MATCH
):
if
'python-format'
in
flags
and
self
.
is_format_only
(
source
,
PYTHON_PRINTF_MATCH
):
...
...
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