mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 06:08:21 +01:00
Enh: Improved support of languages unsupported Yii2
This commit is contained in:
parent
b767ded5ec
commit
2afb228489
@ -8,8 +8,8 @@
|
||||
|
||||
namespace humhub\components\i18n;
|
||||
|
||||
use Yii;
|
||||
use humhub\models\forms\ChooseLanguage;
|
||||
use Yii;
|
||||
use yii\base\InvalidParamException;
|
||||
|
||||
/**
|
||||
@ -25,6 +25,15 @@ class I18N extends \yii\i18n\I18N
|
||||
*/
|
||||
public $messageOverwritePath = '@config/messages';
|
||||
|
||||
/**
|
||||
* Languages which are not supported by Yii.
|
||||
* To overwrite this languages, a language file called "humhub.yii.php"
|
||||
* needs to be placed in the messages folder.
|
||||
*
|
||||
* @var array list of languages
|
||||
*/
|
||||
public $unsupportedYiiLanguages = ['an'];
|
||||
|
||||
/**
|
||||
* Automatically sets the current locale and time zone
|
||||
*/
|
||||
@ -99,7 +108,7 @@ class I18N extends \yii\i18n\I18N
|
||||
*/
|
||||
public function setDefaultLocale()
|
||||
{
|
||||
$this->setLocale( Yii::$app->settings->get('defaultLanguage'));
|
||||
$this->setLocale(Yii::$app->settings->get('defaultLanguage'));
|
||||
$this->fixLocaleCodes();
|
||||
}
|
||||
|
||||
@ -136,6 +145,10 @@ class I18N extends \yii\i18n\I18N
|
||||
$language = 'nb-NO';
|
||||
}
|
||||
|
||||
if ($category === 'yii' && in_array($language, $this->unsupportedYiiLanguages)) {
|
||||
$category = 'humhub.yii';
|
||||
}
|
||||
|
||||
return parent::translate($category, $message, $params, $language);
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,10 @@ $config = [
|
||||
'class' => 'yii\i18n\PhpMessageSource',
|
||||
'basePath' => '@humhub/messages'
|
||||
],
|
||||
'humhub.yii' => [
|
||||
'class' => 'yii\i18n\PhpMessageSource',
|
||||
'basePath' => '@humhub/messages'
|
||||
],
|
||||
],
|
||||
],
|
||||
'formatter' => [
|
||||
|
@ -9,6 +9,7 @@ HumHub Change Log
|
||||
- Fix: No e-mail summary immediately after installation
|
||||
- Enh: Added queuing for search updates of commments
|
||||
- Enh: Added queue clear option at Administration - Information
|
||||
- Enh: Improved support of languages unsupported Yii2
|
||||
|
||||
|
||||
1.3.1 (August 7, 2018)
|
||||
|
3
protected/humhub/messages/an/humhub.yii.php
Normal file
3
protected/humhub/messages/an/humhub.yii.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
return [];
|
Loading…
x
Reference in New Issue
Block a user