mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-24 01:32:25 +01:00
Fix translated fields not switching to fallback language (closes #14)
This commit is contained in:
parent
e95b953891
commit
4c02b73f3a
@ -20,6 +20,13 @@ class Translator
|
||||
*/
|
||||
protected static $ignore = array('name', 'type', 'import', 'fields');
|
||||
|
||||
/**
|
||||
* Keys of which array value has to be ignored
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $ignoreArrayKeys = array('value', 'options');
|
||||
|
||||
/**
|
||||
* Translate a field
|
||||
*/
|
||||
@ -31,6 +38,8 @@ class Translator
|
||||
if (is_array($value)) {
|
||||
if (isset($value[$language])) {
|
||||
$value = $value[$language];
|
||||
} elseif (!in_array($key, static::$ignoreArrayKeys, true)) {
|
||||
$value = array_shift($value);
|
||||
}
|
||||
} elseif (!is_string($value)) {
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user