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
6534911e
Commit
6534911e
authored
Dec 18, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6570 from yiisoft/date-picker-fallback
Added fallback for datepicker language files
parents
87b10f2c
ce01de42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
CHANGELOG.md
extensions/jui/CHANGELOG.md
+1
-1
DatePicker.php
extensions/jui/DatePicker.php
+8
-1
No files found.
extensions/jui/CHANGELOG.md
View file @
6534911e
...
...
@@ -4,7 +4,7 @@ Yii Framework 2 jui extension Change Log
2.
0.2 under development
-----------------------
-
no changes in this release.
-
Enh #6570: Datepicker now uses fallback to find language files, e.g. application language is
`de-DE`
and the translation files does not exists, it will use
`de`
instead (cebe)
2.0.1 December 07, 2014
...
...
extensions/jui/DatePicker.php
View file @
6534911e
...
...
@@ -54,8 +54,11 @@ use yii\helpers\Json;
class
DatePicker
extends
InputWidget
{
/**
* @var string the locale ID (e
g 'fr', 'de
') for the language to be used by the date picker.
* @var string the locale ID (e
.g. 'fr', 'de', 'en-GB
') for the language to be used by the date picker.
* If this property is empty, then the current application language will be used.
*
* Since version 2.0.2 a fallback is used if the application language includes a locale part (e.g. `de-DE`) and the language
* file does not exist, it will fall back to using `de`.
*/
public
$language
;
/**
...
...
@@ -134,6 +137,10 @@ class DatePicker extends InputWidget
$view
=
$this
->
getView
();
$bundle
=
DatePickerLanguageAsset
::
register
(
$view
);
if
(
$bundle
->
autoGenerate
)
{
$fallbackLanguage
=
substr
(
$language
,
0
,
2
);
if
(
$fallbackLanguage
!==
$language
&&
!
file_exists
(
Yii
::
getAlias
(
$bundle
->
sourcePath
.
"/ui/i18n/datepicker-
$language
.js"
)))
{
$language
=
$fallbackLanguage
;
}
$view
->
registerJsFile
(
$bundle
->
baseUrl
.
"/ui/i18n/datepicker-
$language
.js"
,
[
'depends'
=>
[
JuiAsset
::
className
()],
]);
...
...
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