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
f90e28df
Commit
f90e28df
authored
Mar 03, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved support for translating PHP files
Issue #965 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
fce20aca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
0 deletions
+33
-0
docs/changes.rst
docs/changes.rst
+1
-0
weblate/trans/formats.py
weblate/trans/formats.py
+21
-0
weblate/trans/tests/test_models.py
weblate/trans/tests/test_models.py
+7
-0
weblate/trans/tests/test_subproject.py
weblate/trans/tests/test_subproject.py
+4
-0
No files found.
docs/changes.rst
View file @
f90e28df
...
...
@@ -41,6 +41,7 @@ Released on ? 2015.
* Added configurable dashboard views.
* Improved notifications on parse erorrs.
* Added option to import components with duplicate name to import_project.
* Improved support for translating PHP files
weblate 2.4
-----------
...
...
weblate/trans/formats.py
View file @
f90e28df
...
...
@@ -403,6 +403,26 @@ class RESXUnit(FileUnit):
return
get_string
(
self
.
template
.
target
)
class
PHPUnit
(
FileUnit
):
def
get_locations
(
self
):
return
''
def
get_context
(
self
):
if
self
.
template
is
not
None
:
return
self
.
template
.
getsource
()
return
''
def
get_source
(
self
):
if
self
.
template
is
not
None
:
return
self
.
template
.
getsource
()
return
self
.
unit
.
getsource
()
def
get_target
(
self
):
if
self
.
unit
is
None
:
return
''
return
self
.
unit
.
gettarget
()
class
FileFormat
(
object
):
'''
Generic object defining file format loader.
...
...
@@ -1071,6 +1091,7 @@ class PhpFormat(FileFormat):
loader
=
(
'php'
,
'phpfile'
)
new_translation
=
'<?php
\
n
'
autoload
=
(
'.php'
,)
unit_class
=
PHPUnit
@
property
def
mimetype
(
self
):
...
...
weblate/trans/tests/test_models.py
View file @
f90e28df
...
...
@@ -282,6 +282,13 @@ class RepoTestCase(TestCase):
'csv-mono/en.csv'
,
)
def
create_php_mono
(
self
):
return
self
.
_create_subproject
(
'php'
,
'php-mono/*.php'
,
'php-mono/en.php'
,
)
def
create_java
(
self
):
return
self
.
_create_subproject
(
'properties'
,
...
...
weblate/trans/tests/test_subproject.py
View file @
f90e28df
...
...
@@ -185,6 +185,10 @@ class SubProjectTest(RepoTestCase):
project
=
self
.
create_csv_mono
()
self
.
verify_subproject
(
project
,
2
,
'cs'
,
4
)
def
test_create_php_mono
(
self
):
project
=
self
.
create_php_mono
()
self
.
verify_subproject
(
project
,
2
,
'cs'
,
4
)
def
test_create_tsv
(
self
):
project
=
self
.
create_tsv
()
self
.
verify_subproject
(
project
,
1
,
'cs'
,
4
,
'Hello, world!'
)
...
...
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