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
06934dd0
Commit
06934dd0
authored
Oct 31, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use context for dictionary lookup as well
parent
3a62d4ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
weblate/trans/views.py
weblate/trans/views.py
+11
-6
No files found.
weblate/trans/views.py
View file @
06934dd0
...
...
@@ -1207,12 +1207,17 @@ def get_dictionary(request, unit_id):
Lists words from dictionary for current translation.
'''
unit
=
get_object_or_404
(
Unit
,
pk
=
int
(
unit_id
))
# split to words
ana
=
StandardAnalyzer
()
words_std
=
[
token
.
text
for
token
in
ana
(
unit
.
get_source_plurals
()[
0
])]
# additionally extract stems, to catch things like plurals
ana
=
StemmingAnalyzer
()
words_stem
=
[
token
.
text
for
token
in
ana
(
unit
.
get_source_plurals
()[
0
])]
words
=
set
()
# Fetch words from all plurals and from context
for
text
in
unit
.
get_source_plurals
()
+
[
unit
.
context
]:
# split to words
ana
=
StandardAnalyzer
()
words
.
union
([
token
.
text
for
token
in
ana
(
unit
.
get_source_plurals
()[
0
])])
# additionally extract stems, to catch things like plurals
ana
=
StemmingAnalyzer
()
words
.
union
([
token
.
text
for
token
in
ana
(
unit
.
get_source_plurals
()[
0
])])
# join both lists
words
=
set
(
words_std
).
union
(
words_stem
)
...
...
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