Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
08cf7e7b
Commit
08cf7e7b
authored
Jan 15, 2014
by
SergeiKutanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
po filles generation.
All the quotation marks must be screened by adding a backslash before them. Otherwise we cannot generate .mo file.
parent
e09b016a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
MessageController.php
framework/console/controllers/MessageController.php
+15
-9
No files found.
framework/console/controllers/MessageController.php
View file @
08cf7e7b
...
...
@@ -189,6 +189,7 @@ class MessageController extends Controller
$merged
=
[];
$untranslated
=
[];
foreach
(
$messages
as
$message
)
{
$message
=
preg_replace
(
'/\\"/'
,
'\"'
,
$message
);
if
(
array_key_exists
(
$message
,
$translated
)
&&
strlen
(
$translated
[
$message
])
>
0
)
{
$merged
[
$message
]
=
$translated
[
$message
];
}
else
{
...
...
@@ -202,15 +203,17 @@ class MessageController extends Controller
$todo
[
$message
]
=
''
;
}
ksort
(
$translated
);
foreach
(
$translated
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
if
(
substr
(
$translation
,
0
,
2
)
===
'@@'
&&
substr
(
$translation
,
-
2
)
===
'@@'
)
{
$todo
[
$message
]
=
$translation
;
}
else
{
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
}
}
}
if
(
$format
===
'php'
){
foreach
(
$translated
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
if
(
substr
(
$translation
,
0
,
2
)
===
'@@'
&&
substr
(
$translation
,
-
2
)
===
'@@'
)
{
$todo
[
$message
]
=
$translation
;
}
else
{
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
}
}
}
}
$merged
=
array_merge
(
$todo
,
$merged
);
if
(
$sort
)
{
ksort
(
$merged
);
...
...
@@ -221,6 +224,8 @@ class MessageController extends Controller
if
(
$format
===
'po'
){
$out_str
=
''
;
foreach
(
$merged
as
$k
=>
$v
){
$k
=
preg_replace
(
'/(\")|(\\\")/'
,
"
\\\"
"
,
$k
);
$v
=
preg_replace
(
'/(\")|(\\\")/'
,
"
\\\"
"
,
$v
);
$out_str
.=
"msgid
\"
$k
\"\n
"
;
$out_str
.=
"msgstr
\"
$v
\"\n
"
;
$out_str
.=
"
\n
"
;
...
...
@@ -233,6 +238,7 @@ class MessageController extends Controller
$merged
=
''
;
sort
(
$messages
);
foreach
(
$messages
as
$message
)
{
$message
=
preg_replace
(
'/(\")|(\\\")/'
,
'\\\"'
,
$message
);
$merged
.=
"msgid
\"
$message
\"\n
"
;
$merged
.=
"msgstr
\"\"\n
"
;
$merged
.=
"
\n
"
;
...
...
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