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
e13b6929
Commit
e13b6929
authored
Mar 04, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stub for upload processing
parent
2190de58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
html/translation.html
html/translation.html
+9
-0
trans/views.py
trans/views.py
+14
-1
urls.py
urls.py
+1
-0
No files found.
html/translation.html
View file @
e13b6929
...
...
@@ -26,6 +26,15 @@
<a
href=
"{{ object.get_download_url }}"
>
{% trans "Download" %}
</a>
{% if user.is_authenticated %}
<form
action=
"{% url 'trans.views.upload_translation' %}"
method=
"post"
>
<table>
{{ form.as_table }}
<tr><td></td><td><input
type=
"submit"
value=
"{% trans "
Upload
"
%}"
/></td></tr>
</table>
</form>
{% endif %}
{% endblock %}
trans/views.py
View file @
e13b6929
...
...
@@ -7,7 +7,7 @@ from django.http import HttpResponse, HttpResponseRedirect
from
django.contrib
import
messages
from
trans.models
import
Project
,
SubProject
,
Translation
,
Unit
,
Suggestion
from
trans.forms
import
TranslationForm
from
trans.forms
import
TranslationForm
,
UploadForm
from
util
import
is_plural
,
split_plural
,
join_plural
import
logging
import
os.path
...
...
@@ -40,10 +40,12 @@ def show_subproject(request, project, subproject):
def
show_translation
(
request
,
project
,
subproject
,
lang
):
obj
=
get_object_or_404
(
Translation
,
language__code
=
lang
,
subproject__slug
=
subproject
,
subproject__project__slug
=
project
)
form
=
UploadForm
()
return
render_to_response
(
'translation.html'
,
RequestContext
(
request
,
{
'object'
:
obj
,
'title'
:
'%s @ %s'
%
(
obj
.
__unicode__
(),
settings
.
SITE_TITLE
),
'form'
:
form
,
}))
def
download_translation
(
request
,
project
,
subproject
,
lang
):
...
...
@@ -171,3 +173,14 @@ def get_string(request, checksum):
return
HttpResponse
(
''
)
return
HttpResponse
(
units
[
0
].
get_source_plurals
()[
0
])
def
upload_translation
(
request
,
project
,
subproject
,
lang
):
obj
=
get_object_or_404
(
Translation
,
language__code
=
lang
,
subproject__slug
=
subproject
,
subproject__project__slug
=
project
)
if
request
.
method
==
'POST'
:
form
=
UploadForm
(
request
.
POST
)
if
form
.
is_valid
():
# FIXME: process upload
messages
.
add_message
(
request
,
messages
.
INFO
,
_
(
'File content successfully merged into translation.'
))
return
HttpResponseRedirect
(
obj
.
get_absolute_url
())
urls.py
View file @
e13b6929
...
...
@@ -9,6 +9,7 @@ urlpatterns = patterns('',
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/$'
,
'trans.views.show_translation'
),
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/translate/$'
,
'trans.views.translate'
),
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/download/$'
,
'trans.views.download_translation'
),
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/upload/$'
,
'trans.views.upload_translation'
),
url
(
r'^js/get/(?P<checksum>[^/]*)/$'
,
'trans.views.get_string'
),
...
...
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