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
edf1259a
Commit
edf1259a
authored
Dec 05, 2014
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2a1e430f
187c59e1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
29 deletions
+33
-29
weblate/html/js/config.js
weblate/html/js/config.js
+0
-1
weblate/html/meta-header.html
weblate/html/meta-header.html
+0
-1
weblate/html/translate.html
weblate/html/translate.html
+1
-0
weblate/media/loader-bootstrap.js
weblate/media/loader-bootstrap.js
+19
-8
weblate/trans/tests/test_js_views.py
weblate/trans/tests/test_js_views.py
+5
-6
weblate/trans/views/js.py
weblate/trans/views/js.py
+5
-10
weblate/urls.py
weblate/urls.py
+3
-3
No files found.
weblate/html/js/config.js
deleted
100644 → 0
View file @
2a1e430f
var
MACHINE_TRANSLATION_SERVICES
=
[{
%
if
machine_services
%
}
'
{{ machine_services|join:"
'
,
'
" }}
'
{
%
endif
%
}];
weblate/html/meta-header.html
View file @
edf1259a
...
...
@@ -19,7 +19,6 @@
<script
src=
"{% get_media_prefix %}bootstrap/js/bootstrap.min.js"
type=
"text/javascript"
></script>
<script
src=
"{% get_media_prefix %}loader-bootstrap.js"
type=
"text/javascript"
></script>
<script
src=
"{% url 'js-catalog' %}"
type=
"text/javascript"
></script>
<script
src=
"{% url 'js-config' %}"
type=
"text/javascript"
></script>
<script
src=
"{% get_media_prefix %}js/bootstrap-datepicker.js"
type=
"text/javascript"
></script>
<link
rel=
"shortcut icon"
href=
"/favicon.ico"
type=
"image/x-icon"
/>
...
...
weblate/html/translate.html
View file @
edf1259a
...
...
@@ -421,6 +421,7 @@
</div>
<a
href=
"{% url 'js-translate' unit_id=unit.id %}"
class=
"hidden"
id=
"js-translate"
></a>
<a
href=
"{% url 'js-mt-services' %}"
class=
"hidden"
id=
"js-mt-services"
></a>
{% if update_lock %}
<a
href=
"{% url 'js-lock' project=unit.translation.subproject.project.slug subproject=unit.translation.subproject.slug lang=unit.translation.language.code %}"
class=
"hidden"
id=
"js-lock"
></a>
{% endif %}
...
...
weblate/media/loader-bootstrap.js
View file @
edf1259a
...
...
@@ -135,6 +135,19 @@ function failed_machine_translation(jqXHR, textStatus, errorThrown) {
);
}
function
load_mt_translations
(
data
,
textStatus
,
jqXHR
)
{
dec_loading
();
data
.
forEach
(
function
(
el
,
idx
,
ar
)
{
inc_loading
();
$
.
ajax
({
url
:
$
(
'
#js-translate
'
).
attr
(
'
href
'
)
+
'
?service=
'
+
el
,
success
:
process_machine_translation
,
error
:
failed_machine_translation
,
dataType
:
'
json
'
});
});
}
function
isNumber
(
n
)
{
return
!
isNaN
(
parseFloat
(
n
))
&&
isFinite
(
n
);
}
...
...
@@ -280,14 +293,12 @@ $(function () {
return
;
}
mt_loaded
=
true
;
MACHINE_TRANSLATION_SERVICES
.
forEach
(
function
(
el
,
idx
,
ar
)
{
inc_loading
();
$
.
ajax
({
url
:
$
(
'
#js-translate
'
).
attr
(
'
href
'
)
+
'
?service=
'
+
el
,
success
:
process_machine_translation
,
error
:
failed_machine_translation
,
dataType
:
'
json
'
});
inc_loading
();
$
.
ajax
({
url
:
$
(
'
#js-mt-services
'
).
attr
(
'
href
'
),
success
:
load_mt_translations
,
error
:
failed_machine_translation
,
dataType
:
'
json
'
});
});
...
...
weblate/trans/tests/test_js_views.py
View file @
edf1259a
...
...
@@ -97,10 +97,9 @@ class JSViewsTest(ViewTestCase):
)
self
.
assertContains
(
response
,
'href="/exports/rss/'
)
def
test_js_config
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'js-config'
))
def
test_mt_services
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'js-mt-services'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
data
=
json
.
loads
(
response
.
content
)
# Check we have dummy service listed
self
.
assertContains
(
response
,
"'dummy'"
)
self
.
assertIn
(
'dummy'
,
data
)
weblate/trans/views/js.py
View file @
edf1259a
...
...
@@ -173,21 +173,16 @@ def git_status_translation(request, project, subproject, lang):
)
def
js_config
(
request
):
def
mt_services
(
request
):
'''
Generates settings for javascript. Includes things like
translaiton services.
Generates list of installed machine translation services in JSON.
'''
# Machine translation
machine_services
=
MACHINE_TRANSLATION_SERVICES
.
keys
()
return
render
(
request
,
'js/config.js'
,
{
'machine_services'
:
machine_services
,
},
content_type
=
'application/javascript'
return
HttpResponse
(
json
.
dumps
(
machine_services
),
content_type
=
'application/json'
)
...
...
weblate/urls.py
View file @
edf1259a
...
...
@@ -587,9 +587,9 @@ urlpatterns = patterns(
name='
js
-
catalog
'
),
url(
r'
^
js
/
config
/
$
',
'
weblate
.
trans
.
views
.
js
.
js_config
',
name='
js
-
config
',
r'
^
js
/
mt
-
services
/
$
',
'
weblate
.
trans
.
views
.
js
.
mt_services
',
name='
js
-
mt
-
services
',
),
url(
r'
^
js
/
translate
/
(
?
P
<
unit_id
>
[
0
-
9
]
+
)
/
$
',
...
...
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