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
803e2e92
Commit
803e2e92
authored
Apr 11, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass unit to translation services
This will allow them to do more introspection if needed
parent
894e86c4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
13 additions
and
12 deletions
+13
-12
trans/machine/apertium.py
trans/machine/apertium.py
+1
-1
trans/machine/base.py
trans/machine/base.py
+3
-3
trans/machine/dummy.py
trans/machine/dummy.py
+1
-1
trans/machine/glosbe.py
trans/machine/glosbe.py
+1
-1
trans/machine/google.py
trans/machine/google.py
+1
-1
trans/machine/microsoft.py
trans/machine/microsoft.py
+1
-1
trans/machine/mymemory.py
trans/machine/mymemory.py
+1
-1
trans/machine/opentran.py
trans/machine/opentran.py
+1
-1
trans/machine/tmserver.py
trans/machine/tmserver.py
+1
-1
trans/views/js.py
trans/views/js.py
+2
-1
No files found.
trans/machine/apertium.py
View file @
803e2e92
...
...
@@ -43,7 +43,7 @@ class ApertiumTranslation(MachineTranslation):
for
item
in
data
[
'responseData'
]
if
item
[
'sourceLanguage'
]
==
'en'
]
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
trans/machine/base.py
View file @
803e2e92
...
...
@@ -116,7 +116,7 @@ class MachineTranslation(object):
'''
return
[]
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
@@ -164,7 +164,7 @@ class MachineTranslation(object):
'''
return
language
in
self
.
supported_languages
def
translate
(
self
,
language
,
text
):
def
translate
(
self
,
language
,
text
,
unit
):
'''
Returns list of machine translations.
'''
...
...
@@ -173,7 +173,7 @@ class MachineTranslation(object):
return
[]
try
:
translations
=
self
.
download_translations
(
language
,
text
)
translations
=
self
.
download_translations
(
language
,
text
,
unit
)
return
[{
'text'
:
trans
[
0
],
'quality'
:
trans
[
1
],
'source'
:
trans
[
2
]}
for
trans
in
translations
]
...
...
trans/machine/dummy.py
View file @
803e2e92
...
...
@@ -33,7 +33,7 @@ class DummyTranslation(MachineTranslation):
'''
return
set
((
'cs'
,))
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Dummy translation supports just single phrase.
'''
...
...
trans/machine/glosbe.py
View file @
803e2e92
...
...
@@ -39,7 +39,7 @@ class GlosbeTranslation(MachineTranslation):
'''
return
True
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
trans/machine/google.py
View file @
803e2e92
...
...
@@ -33,7 +33,7 @@ class GoogleTranslation(MachineTranslation):
'''
return
True
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
trans/machine/microsoft.py
View file @
803e2e92
...
...
@@ -107,7 +107,7 @@ class MicrosoftTranslation(MachineTranslation):
data
=
self
.
json_req
(
LIST_URL
)
return
data
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
trans/machine/mymemory.py
View file @
803e2e92
...
...
@@ -62,7 +62,7 @@ class MyMemoryTranslation(MachineTranslation):
source
)
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
trans/machine/opentran.py
View file @
803e2e92
...
...
@@ -50,7 +50,7 @@ class OpenTranTranslation(MachineTranslation):
self
.
name
)
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
trans/machine/tmserver.py
View file @
803e2e92
...
...
@@ -52,7 +52,7 @@ class TMServerTranslation(MachineTranslation):
'''
return
True
def
download_translations
(
self
,
language
,
text
):
def
download_translations
(
self
,
language
,
text
,
unit
):
'''
Downloads list of possible translations from a service.
'''
...
...
trans/views/js.py
View file @
803e2e92
...
...
@@ -97,7 +97,8 @@ def translate(request, unit_id):
try
:
response
[
'translations'
]
=
translation_service
.
translate
(
unit
.
translation
.
language
.
code
,
unit
.
get_source_plurals
()[
0
]
unit
.
get_source_plurals
()[
0
],
unit
)
response
[
'responseStatus'
]
=
200
except
Exception
as
exc
:
...
...
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