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
bc3200ce
Commit
bc3200ce
authored
Jul 17, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4295: reworked message extraction for PO files
parent
21910c61
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
69 deletions
+159
-69
MessageController.php
framework/console/controllers/MessageController.php
+129
-58
messageConfig.php
framework/views/messageConfig.php
+25
-6
MessageControllerTest.php
...t/framework/console/controllers/MessageControllerTest.php
+5
-5
No files found.
framework/console/controllers/MessageController.php
View file @
bc3200ce
This diff is collapsed.
Click to expand it.
framework/views/messageConfig.php
View file @
bc3200ce
...
...
@@ -3,8 +3,6 @@
return
[
// string, required, root directory of all source files
'sourcePath'
=>
__DIR__
,
// string, required, root directory containing message translations.
'messagePath'
=>
__DIR__
.
DIRECTORY_SEPARATOR
.
'messages'
,
// array, required, list of language codes that the extracted messages
// should be translated to. For example, ['zh-CN', 'de'].
'languages'
=>
[
'de'
],
...
...
@@ -44,9 +42,30 @@ return [
'.hgkeep'
,
'/messages'
,
],
// Generated file format. Can be either "php", "po" or "db".
// 'php' output format is for saving messages to php files.
'format'
=>
'php'
,
// When format is "db", you may specify the following two options
//'db' => 'db',
//'sourceMessageTable' => '{{%source_message}}',
// Root directory containing message translations.
'messagePath'
=>
__DIR__
.
DIRECTORY_SEPARATOR
.
'messages'
,
/*
// 'db' output format is for saving messages to database.
'format' => 'db',
// Connection component to use. Optional.
'db' => 'db',
// Custom source message table. Optional.
// 'sourceMessageTable' => '{{%source_message}}',
// Custom name for translation message table. Optional.
// 'messageTable' => '{{%message}}',
*/
/*
// 'po' output format is for saving messages to gettext po files.
'format' => 'po',
// Root directory containing message translations.
'messagePath' => __DIR__ . DIRECTORY_SEPARATOR . 'messages',
// Name of the file that will be used for translations.
'catalog' => 'messages',
*/
];
tests/unit/framework/console/controllers/MessageControllerTest.php
View file @
bc3200ce
...
...
@@ -255,13 +255,13 @@ class MessageControllerTest extends TestCase
'messagePath'
=>
$this
->
messagePath
,
'overwrite'
=>
true
,
]);
$this
->
runMessageControllerAction
(
'extract'
,
[
$this
->
configFileName
]);
$
commandOutput
=
$
this
->
runMessageControllerAction
(
'extract'
,
[
$this
->
configFileName
]);
$messages
=
require
(
$this
->
messagePath
.
DIRECTORY_SEPARATOR
.
$messageFileName
);
$this
->
assertTrue
(
array_key_exists
(
$newMessage
,
$messages
),
'Unable to add new message
!'
);
$this
->
assertTrue
(
array_key_exists
(
$existingMessage
,
$messages
),
'Unable to keep existing message
!'
);
$this
->
assertEquals
(
''
,
$messages
[
$newMessage
],
'Wrong new message content!
'
);
$this
->
assertEquals
(
$existingMessageContent
,
$messages
[
$existingMessage
],
'Unable to keep existing message content!
'
);
$this
->
assertTrue
(
array_key_exists
(
$newMessage
,
$messages
),
'Unable to add new message
: "'
.
$newMessage
.
'". Command output was:'
.
"
\n
"
.
$commandOutput
);
$this
->
assertTrue
(
array_key_exists
(
$existingMessage
,
$messages
),
'Unable to keep existing message
: "'
.
$existingMessage
.
'". Command output was:'
.
"
\n
"
.
$commandOutput
);
$this
->
assertEquals
(
''
,
$messages
[
$newMessage
],
'Wrong new message content!
. Command output was:\n'
.
$commandOutput
);
$this
->
assertEquals
(
$existingMessageContent
,
$messages
[
$existingMessage
],
'Unable to keep existing message content!
. Command output was:'
.
"
\n
"
.
$commandOutput
);
}
/**
...
...
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