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
b18c050f
Commit
b18c050f
authored
Mar 23, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
9f1e1473
2b870ddf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
55 deletions
+65
-55
locale/el/LC_MESSAGES/djangojs.po
locale/el/LC_MESSAGES/djangojs.po
+14
-14
settings.py
settings.py
+1
-0
trans/managers.py
trans/managers.py
+2
-2
trans/models.py
trans/models.py
+48
-39
No files found.
locale/el/LC_MESSAGES/djangojs.po
View file @
b18c050f
...
...
@@ -3,53 +3,53 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-03-23 07:46+0100\n"
"PO-Revision-Date:
YEAR-MO-DA HO:MI+ZONE
\n"
"Last-Translator:
FULL NAME <EMAIL@ADDRESS
>\n"
"PO-Revision-Date:
2012-03-23 11:03+0200
\n"
"Last-Translator:
Panagiotis Papazoglou <papaz_p@yahoo.com
>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"Language:
el
\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 0.8\n"
#: media/js/loader.js:36
msgid "Failed translation"
msgstr ""
msgstr "
Αποτυχημένη μετάφραση
"
#: media/js/loader.js:36
msgid "The request for machine translation has failed."
msgstr ""
msgstr "
Το αίτημα για μηχανική μετάφραση απέτυχε.
"
#: media/js/loader.js:36
msgid "Error details:"
msgstr ""
msgstr "
Λεπτομέρειες σφάλματος:
"
#: media/js/loader.js:55
msgid "Translate using Apertium"
msgstr ""
msgstr "
Μετάφραση με χρήση του Apertium
"
#: media/js/loader.js:70
msgid "Translate using Microsoft Translator"
msgstr ""
msgstr "
Μετάφραση με χρήση του Microsoft Translator
"
#: media/js/loader.js:84
msgid "Translate using MyMemory"
msgstr ""
msgstr "
Μετάφραση με χρήση του MyMemory
"
#: media/js/loader.js:158
msgid "Sort this column"
msgstr ""
msgstr "
Ταξινόμηση αυτής της στήλης
"
#: media/js/loader.js:188
msgid "AJAX request to load this content has failed!"
msgstr ""
msgstr "
Το αίτημα AJAX για φόρτωση αυτού του περιεχομένου απέτυχε!
"
#: media/js/loader.js:202
msgid "Loading..."
msgstr ""
msgstr "
Φόρτωση...
"
settings.py
View file @
b18c050f
...
...
@@ -43,6 +43,7 @@ LANGUAGES = (
(
'cs'
,
u'Česky'
),
(
'de'
,
'Deutsch'
),
(
'en'
,
'English'
),
(
'el'
,
'Ελληνικά'
),
(
'es'
,
u'Español'
),
(
'fr'
,
u'Français'
),
(
'nl'
,
'Nederlands'
),
...
...
trans/managers.py
View file @
b18c050f
...
...
@@ -68,7 +68,7 @@ IGNORE_SIMILAR = set([
])
|
IGNORE_WORDS
class
TranslationManager
(
models
.
Manager
):
def
update_from_blob
(
self
,
subproject
,
code
,
path
,
blob
,
force
=
False
):
def
update_from_blob
(
self
,
subproject
,
code
,
path
,
blob
_hash
,
force
=
False
):
'''
Parses translation meta info and creates/updates translation object.
'''
...
...
@@ -77,7 +77,7 @@ class TranslationManager(models.Manager):
language
=
lang
,
subproject
=
subproject
,
filename
=
path
)
trans
.
update_from_blob
(
blob
,
force
)
trans
.
update_from_blob
(
blob
_hash
,
force
)
class
UnitManager
(
models
.
Manager
):
def
update_from_unit
(
self
,
translation
,
unit
,
pos
):
...
...
trans/models.py
View file @
b18c050f
...
...
@@ -113,49 +113,51 @@ class SubProject(models.Model):
Ensures repository is correctly configured and points to current remote.
'''
# Create/Open repo
repo
=
self
.
get_repo
()
git
repo
=
self
.
get_repo
()
# Get/Create origin remote
try
:
origin
=
repo
.
remotes
.
origin
origin
=
git
repo
.
remotes
.
origin
except
:
repo
.
git
.
remote
(
'add'
,
'origin'
,
self
.
repo
)
origin
=
repo
.
remotes
.
origin
git
repo
.
git
.
remote
(
'add'
,
'origin'
,
self
.
repo
)
origin
=
git
repo
.
remotes
.
origin
# Check remote source
if
origin
.
url
!=
self
.
repo
:
repo
.
git
.
remote
(
'set-url'
,
'origin'
,
self
.
repo
)
git
repo
.
git
.
remote
(
'set-url'
,
'origin'
,
self
.
repo
)
# Update
logger
.
info
(
'updating repo %s'
,
self
.
__unicode__
())
try
:
repo
.
git
.
remote
(
'update'
,
'origin'
)
git
repo
.
git
.
remote
(
'update'
,
'origin'
)
except
Exception
,
e
:
logger
.
error
(
'Failed to update Git repo: %s'
,
str
(
e
))
del
gitrepo
def
configure_branch
(
self
):
'''
Ensures local tracking branch exists and is checkouted.
'''
repo
=
self
.
get_repo
()
git
repo
=
self
.
get_repo
()
try
:
head
=
repo
.
heads
[
self
.
branch
]
head
=
git
repo
.
heads
[
self
.
branch
]
except
:
repo
.
git
.
branch
(
'--track'
,
self
.
branch
,
'origin/%s'
%
self
.
branch
)
head
=
repo
.
heads
[
self
.
branch
]
repo
.
git
.
checkout
(
self
.
branch
)
gitrepo
.
git
.
branch
(
'--track'
,
self
.
branch
,
'origin/%s'
%
self
.
branch
)
head
=
gitrepo
.
heads
[
self
.
branch
]
gitrepo
.
git
.
checkout
(
self
.
branch
)
del
gitrepo
def
update_branch
(
self
):
'''
Updates current branch to match remote (if possible).
'''
repo
=
self
.
get_repo
()
git
repo
=
self
.
get_repo
()
logger
.
info
(
'pulling from remote repo %s'
,
self
.
__unicode__
())
repo
.
remotes
.
origin
.
update
()
git
repo
.
remotes
.
origin
.
update
()
try
:
repo
.
git
.
merge
(
'origin/%s'
%
self
.
branch
)
git
repo
.
git
.
merge
(
'origin/%s'
%
self
.
branch
)
logger
.
info
(
'merged remote into repo %s'
,
self
.
__unicode__
())
except
Exception
,
e
:
status
=
repo
.
git
.
status
()
repo
.
git
.
merge
(
'--abort'
)
status
=
git
repo
.
git
.
status
()
git
repo
.
git
.
merge
(
'--abort'
)
logger
.
warning
(
'failed merge on repo %s'
,
self
.
__unicode__
())
msg
=
'Error:
\
n
%s'
%
str
(
e
)
msg
+=
'
\
n
\
n
Status:
\
n
'
+
status
...
...
@@ -163,13 +165,14 @@ class SubProject(models.Model):
'failed merge on repo %s'
%
self
.
__unicode__
(),
msg
)
del
gitrepo
def
get_translation_blobs
(
self
):
'''
Scans directory for translation blobs and returns them as list
.
Iterator over translations in filesystem
.
'''
repo
=
self
.
get_repo
()
tree
=
repo
.
tree
()
git
repo
=
self
.
get_repo
()
tree
=
git
repo
.
tree
()
# Glob files
prefix
=
os
.
path
.
join
(
self
.
get_path
(),
''
)
...
...
@@ -178,16 +181,17 @@ class SubProject(models.Model):
yield
(
self
.
get_lang_code
(
filename
),
filename
,
tree
[
filename
]
tree
[
filename
]
.
hexsha
)
del
gitrepo
def
create_translations
(
self
,
force
=
False
):
'''
Loads translations from git.
'''
for
code
,
path
,
blob
in
self
.
get_translation_blobs
():
for
code
,
path
,
blob
_hash
in
self
.
get_translation_blobs
():
logger
.
info
(
'checking %s'
,
path
)
Translation
.
objects
.
update_from_blob
(
self
,
code
,
path
,
blob
,
force
)
Translation
.
objects
.
update_from_blob
(
self
,
code
,
path
,
blob
_hash
,
force
)
def
get_lang_code
(
self
,
path
):
'''
...
...
@@ -278,15 +282,17 @@ class Translation(models.Model):
'''
Checks whether database is in sync with git and possibly does update.
'''
blob
=
self
.
get_git_blob
()
self
.
update_from_blob
(
blob
)
self
.
update_from_blob
()
def
update_from_blob
(
self
,
blob
,
force
=
False
):
def
update_from_blob
(
self
,
blob
_hash
=
None
,
force
=
False
):
'''
Updates translation data from blob.
'''
if
blob_hash
is
None
:
blob_hash
=
self
.
get_git_blob_hash
()
# Check if we're not already up to date
if
self
.
revision
==
blob
.
hexsha
and
not
force
:
if
self
.
revision
==
blob
_hash
and
not
force
:
return
logger
.
info
(
'processing %s, revision has changed'
,
self
.
filename
)
...
...
@@ -308,23 +314,25 @@ class Translation(models.Model):
Unit
.
objects
.
filter
(
translation
=
self
,
id__in
=
oldunits
).
delete
()
# Update revision and stats
self
.
update_stats
(
blob
)
self
.
update_stats
(
blob
_hash
)
def
get_git_blob
(
self
):
def
get_git_blob
_hash
(
self
):
'''
Returns current Git blob for file.
Returns current Git blob
hash
for file.
'''
repo
=
self
.
subproject
.
get_repo
()
tree
=
repo
.
tree
()
return
tree
[
self
.
filename
]
gitrepo
=
self
.
subproject
.
get_repo
()
tree
=
gitrepo
.
tree
()
ret
=
tree
[
self
.
filename
].
hexsha
del
gitrepo
return
ret
def
update_stats
(
self
,
blob
=
None
):
if
blob
is
None
:
blob
=
self
.
get_git_blob
()
def
update_stats
(
self
,
blob
_hash
=
None
):
if
blob
_hash
is
None
:
blob
_hash
=
self
.
get_git_blob_hash
()
self
.
total
=
self
.
unit_set
.
count
()
self
.
fuzzy
=
self
.
unit_set
.
filter
(
fuzzy
=
True
).
count
()
self
.
translated
=
self
.
unit_set
.
filter
(
translated
=
True
).
count
()
self
.
revision
=
blob
.
hexsha
self
.
revision
=
blob
_hash
self
.
save
()
def
get_author_name
(
self
,
request
):
...
...
@@ -337,17 +345,18 @@ class Translation(models.Model):
'''
Commits translation to git.
'''
repo
=
self
.
subproject
.
get_repo
()
status
=
repo
.
git
.
status
(
'--porcelain'
,
'--'
,
self
.
filename
)
git
repo
=
self
.
subproject
.
get_repo
()
status
=
git
repo
.
git
.
status
(
'--porcelain'
,
'--'
,
self
.
filename
)
if
status
==
''
:
# No changes to commit
return
False
logger
.
info
(
'Commiting %s as %s'
,
self
.
filename
,
author
)
repo
.
git
.
commit
(
git
repo
.
git
.
commit
(
self
.
filename
,
author
=
author
,
m
=
settings
.
COMMIT_MESSAGE
)
del
gitrepo
return
True
def
update_unit
(
self
,
unit
,
request
):
...
...
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