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
c3e6b0d4
Commit
c3e6b0d4
authored
Nov 13, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache BBcode and printf parsing results for source string
parent
e2438f2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
weblate/trans/checks.py
weblate/trans/checks.py
+14
-2
No files found.
weblate/trans/checks.py
View file @
c3e6b0d4
...
...
@@ -219,7 +219,11 @@ class Check(object):
'''
if len(target) == 0 or len(source) == 0:
return False
src_matches = set([x[0] for x in regex.findall(source)])
# Try geting source parsing from cache
src_matches = self.get_cache(unit)
# Cache miss
if src_matches is None:
src_matches = set([x[0] for x in regex.findall(source)])
tgt_matches = set([x[0] for x in regex.findall(target)])
# We ignore %% as this is really not relevant. However it needs
# to be matched to prevent handling %%s as %s.
...
...
@@ -615,14 +619,22 @@ class BBCodeCheck(TargetCheck):
description
=
_
(
'BBcode in translation does not match source'
)
def
check_single
(
self
,
source
,
target
,
flags
,
language
,
unit
):
src_match
=
BBCODE_MATCH
.
findall
(
source
)
# Try geting source parsing from cache
src_match
=
self
.
get_cache
(
unit
)
# Cache miss
if
src_match
is
None
:
src_match
=
BBCODE_MATCH
.
findall
(
source
)
# Any BBCode in source?
if
len
(
src_match
)
==
0
:
return
False
# Parse target
tgt_match
=
BBCODE_MATCH
.
findall
(
target
)
if
len
(
src_match
)
!=
len
(
tgt_match
):
return
True
src_tags
=
set
([
x
[
0
]
for
x
in
src_match
])
tgt_tags
=
set
([
x
[
0
]
for
x
in
tgt_match
])
return
(
src_tags
!=
tgt_tags
)
class
ZeroWidthSpaceCheck
(
TargetCheck
):
...
...
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