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
f2b58548
Commit
f2b58548
authored
Nov 27, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The import_project now understand langauge filtering
Fixes #904 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
f02f470e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
5 deletions
+43
-5
docs/admin/management.rst
docs/admin/management.rst
+3
-0
docs/changes.rst
docs/changes.rst
+1
-0
weblate/trans/management/commands/import_project.py
weblate/trans/management/commands/import_project.py
+24
-5
weblate/trans/tests/test_commands.py
weblate/trans/tests/test_commands.py
+15
-0
No files found.
docs/admin/management.rst
View file @
f2b58548
...
...
@@ -139,6 +139,9 @@ base file for monolingual translations.
You can also specify file format to use (see :ref:`formats`) by the
``--file-format`` parameter. The default is autodetection.
You can specify language filtering (see :ref:`component`) by the
``--language-filter`` parameter. It has to be valid regullar expression.
In case you need to specify version control system to use, you can do this using
``--vcs`` parameter. The default version control is Git.
...
...
docs/changes.rst
View file @
f2b58548
...
...
@@ -23,6 +23,7 @@ Released on ? 2015.
* Fixed sitewide search for failing checks.
* Added option to specify source language.
* Improved support for XLIFF files.
* Extended list of options for import_project.
weblate 2.4
-----------
...
...
weblate/trans/management/commands/import_project.py
View file @
f2b58548
...
...
@@ -70,6 +70,14 @@ class Command(BaseCommand):
default
=
'auto'
,
help
=
'File format type, defaults to autodetection'
,
),
make_option
(
'--language-filter'
,
default
=
None
,
help
=
(
'Language filter regular expression to be used for created'
' components'
),
),
make_option
(
'--vcs'
,
default
=
'git'
,
...
...
@@ -82,6 +90,7 @@ class Command(BaseCommand):
self
.
filemask
=
None
self
.
component_re
=
None
self
.
file_format
=
None
self
.
language_filter
=
None
self
.
name_template
=
None
self
.
base_file_template
=
None
self
.
vcs
=
None
...
...
@@ -179,6 +188,7 @@ class Command(BaseCommand):
self
.
filemask
=
args
[
3
]
self
.
vcs
=
options
[
'vcs'
]
self
.
file_format
=
options
[
'file_format'
]
self
.
language_filter
=
options
[
'language_filter'
]
self
.
name_template
=
options
[
'name_template'
]
self
.
base_file_template
=
options
[
'base_file_template'
]
if
options
[
'component_regexp'
]:
...
...
@@ -256,10 +266,20 @@ class Command(BaseCommand):
repo
=
sharedrepo
,
branch
=
branch
,
template
=
template
,
file
_format
=
self
.
file_format
,
filemask
=
self
.
filemask
.
replace
(
'**'
,
match
)
file
mask
=
self
.
filemask
.
replace
(
'**'
,
match
)
,
**
self
.
get_project_attribs
(
)
)
def
get_project_attribs
(
self
):
result
=
{
'file_format'
:
self
.
file_format
,
'vcs'
:
self
.
vcs
,
}
if
self
.
language_filter
is
not
None
:
result
[
'language_regex'
]
=
self
.
language_filter
return
result
def
import_initial
(
self
,
project
,
repo
,
branch
):
'''
Import the first repository of a project
...
...
@@ -297,10 +317,9 @@ class Command(BaseCommand):
project
=
project
,
repo
=
repo
,
branch
=
branch
,
file_format
=
self
.
file_format
,
vcs
=
self
.
vcs
,
template
=
template
,
filemask
=
self
.
filemask
.
replace
(
'**'
,
match
)
filemask
=
self
.
filemask
.
replace
(
'**'
,
match
),
**
self
.
get_project_attribs
()
)
sharedrepo
=
'weblate://%s/%s'
%
(
project
.
slug
,
slug
)
...
...
weblate/trans/tests/test_commands.py
View file @
f2b58548
...
...
@@ -53,6 +53,21 @@ class ImportProjectTest(RepoTestCase):
# We should have loaded four subprojects
self
.
assertEqual
(
project
.
subproject_set
.
count
(),
4
)
def
test_import_filter
(
self
):
project
=
self
.
create_project
()
call_command
(
'import_project'
,
'test'
,
self
.
git_repo_path
,
'master'
,
'**/*.po'
,
language_filter
=
'cs'
)
# We should have loaded four subprojects
self
.
assertEqual
(
project
.
subproject_set
.
count
(),
4
)
for
component
in
project
.
subproject_set
.
all
():
self
.
assertEqual
(
component
.
translation_set
.
count
(),
1
)
def
test_import_re
(
self
):
project
=
self
.
create_project
()
call_command
(
...
...
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