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
3ef3b324
Commit
3ef3b324
authored
Oct 29, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #907 from ejjoman/master
Allow to add new languages with Qt TS files using lupdate command
parents
5fb14be3
2c41a78b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
weblate/trans/formats.py
weblate/trans/formats.py
+43
-0
No files found.
weblate/trans/formats.py
View file @
3ef3b324
...
...
@@ -882,6 +882,49 @@ class TSFormat(FileFormat):
loader
=
(
'ts2'
,
'tsfile'
)
autoload
=
(
'.ts'
,)
unit_class
=
MonolingualIDUnit
lupdate_found
=
None
@
classmethod
def
supports_new_language
(
cls
):
'''
Checks whether we can create new language file.
'''
if
cls
.
lupdate_found
is
None
:
try
:
ret
=
subprocess
.
check_call
(
[
'lupdate'
,
'--help'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
env
=
get_clean_env
(),
)
cls
.
lupdate_found
=
(
ret
==
0
)
except
(
subprocess
.
CalledProcessError
,
OSError
):
cls
.
lupdate_found
=
False
return
cls
.
lupdate_found
@
classmethod
def
create_new_file
(
cls
,
filename
,
code
,
base
):
process
=
subprocess
.
Popen
(
[
'lupdate'
,
'-target-language'
,
code
,
base
,
'-ts'
,
filename
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
env
=
get_clean_env
(),
)
output
,
output_err
=
process
.
communicate
()
retcode
=
process
.
poll
()
if
retcode
:
raise
ValueError
(
output_err
if
output_err
else
output
)
@
register_fileformat
...
...
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