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
34e263cd
Commit
34e263cd
authored
Dec 13, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify code
parent
b50a07d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
weblate/trans/checks.py
weblate/trans/checks.py
+10
-6
No files found.
weblate/trans/checks.py
View file @
34e263cd
...
...
@@ -305,22 +305,26 @@ class SameCheck(TargetCheck):
name
=
_
(
'Not translated'
)
description
=
_
(
'Source and translated strings are same'
)
def
is_format_only
(
self
,
msg
,
regex
):
def
is_format_only
(
self
,
msg
,
flags
):
'''
Checks whether given string contains only format strings
and possible punctation. These are quite often not changed
by translators.
'''
if
'python-format'
in
flags
:
regex
=
PYTHON_PRINTF_MATCH
elif
'php-format'
in
flags
:
regex
=
PHP_PRINTF_MATCH
elif
'c-format'
in
flags
:
regex
=
C_PRINTF_MATCH
else
:
return
False
stripped
=
regex
.
sub
(
''
,
msg
)
return
stripped
.
strip
(
' ,./<>?;
\
'
\
\
:"|[]{}`~!@#$%^&*()-=_+'
)
==
''
def
check_single
(
self
,
source
,
target
,
flags
,
language
,
unit
):
# Ignore strings which don't contain any string to translate
if
'python-format'
in
flags
and
self
.
is_format_only
(
source
,
PYTHON_PRINTF_MATCH
):
return
False
elif
'php-format'
in
flags
and
self
.
is_format_only
(
source
,
PHP_PRINTF_MATCH
):
return
False
elif
'c-format'
in
flags
and
self
.
is_format_only
(
source
,
C_PRINTF_MATCH
):
if
self
.
is_format_only
(
source
,
PYTHON_PRINTF_MATCH
):
return
False
# One letter things are usually labels or decimal/thousand separators
...
...
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