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
311bd469
Commit
311bd469
authored
Mar 20, 2014
by
Luciano Baraglia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes in GII I18N
parent
d54c6159
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
Generator.php
extensions/gii/Generator.php
+2
-2
gii.js
extensions/gii/assets/gii.js
+2
-2
Generator.php
extensions/gii/generators/crud/Generator.php
+1
-1
search.php
extensions/gii/generators/crud/default/search.php
+1
-1
No files found.
extensions/gii/Generator.php
View file @
311bd469
...
...
@@ -457,7 +457,7 @@ abstract class Generator extends Model
public
function
generateString
(
$string
=
''
,
$placeholders
=
[]){
if
(
$this
->
enableI18N
)
{
// If there are placeholders, use them
if
(
count
(
$placeholders
)
>
0
)
{
if
(
!
empty
(
$placeholders
)
)
{
$search
=
[
'array ('
,
')'
];
$replace
=
[
'['
,
']'
];
$ph
=
', '
.
str_replace
(
$search
,
$replace
,
var_export
(
$placeholders
,
true
));
...
...
@@ -467,7 +467,7 @@ abstract class Generator extends Model
$str
=
"Yii::t('"
.
$this
->
translationCategory
.
"', '"
.
$string
.
"'"
.
$ph
.
")"
;
}
else
{
// No I18N, replace placeholders by real words, if any
if
(
count
(
$placeholders
)
>
0
)
{
if
(
!
empty
(
$placeholders
)
)
{
$phKeys
=
array_map
(
function
(
$word
)
{
return
'{'
.
$word
.
'}'
;
},
array_keys
(
$placeholders
));
...
...
extensions/gii/assets/gii.js
View file @
311bd469
...
...
@@ -111,12 +111,12 @@ yii.gii = (function ($) {
initConfirmationCheckboxes
();
// model generator: hide class name input when table name input contains *
$
(
'#model-generator #generator-tablename'
).
on
(
'change'
,
function
()
{
$
(
'#model-generator #generator-tablename'
).
change
(
function
()
{
$
(
'#model-generator .field-generator-modelclass'
).
toggle
(
$
(
this
).
val
().
indexOf
(
'*'
)
==
-
1
);
}).
change
();
// CRUD generator: hide translationCategory when I18N is disabled
$
(
'#crud-generator #generator-enablei18n'
).
on
(
'change'
,
function
()
{
$
(
'#crud-generator #generator-enablei18n'
).
change
(
function
()
{
$
(
'#crud-generator .field-generator-translationcategory'
).
toggle
(
$
(
this
).
is
(
':checked'
));
}).
change
();
...
...
extensions/gii/generators/crud/Generator.php
View file @
311bd469
...
...
@@ -166,7 +166,7 @@ class Generator extends \yii\gii\Generator
*/
public
function
validateTranslationCategory
()
{
if
(
(
boolean
)
$this
->
enableI18N
&&
empty
(
$this
->
translationCategory
))
{
if
(
$this
->
enableI18N
&&
empty
(
$this
->
translationCategory
))
{
$this
->
addError
(
'translationCategory'
,
"Translation Category cannot be blank."
);
}
}
...
...
extensions/gii/generators/crud/default/search.php
View file @
311bd469
...
...
@@ -49,7 +49,7 @@ class <?= $searchModelClass ?> extends Model
{
return [
<?php
foreach
(
$labels
as
$name
=>
$label
)
:
?>
<?=
"'
$name
' => "
.
$generator
->
generateString
(
addslashes
(
$label
))
.
",
\n
"
?>
<?=
"'
$name
' => "
.
addslashes
(
$generator
->
generateString
(
$label
))
.
",
\n
"
?>
<?php
endforeach
;
?>
];
}
...
...
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