Fix bug translation for Firstname/Lastname of Profile

This commit is contained in:
githubjeka 2017-03-03 10:14:37 +03:00
parent 921f083b4f
commit 214c9d88a7
5 changed files with 20 additions and 11 deletions

View File

@ -1,3 +1,9 @@
<?php
/**
* @var $hForm \humhub\compat\HForm
* @see \humhub\modules\installer\controllers\ConfigController::actionAdmin()
*/
?>
<div id="create-admin-account-form" class="panel panel-default animated fadeIn">
<div class="panel-heading">

View File

@ -26,12 +26,12 @@ return [
'Facebook URL' => 'Страница Facebook',
'Fax' => 'Факс',
'Female' => 'Женский',
'Firstname' => 'Имя',
'First name' => 'Имя',
'Flickr URL' => 'Станица Flickr',
'Gender' => 'Пол',
'Google+ URL' => 'Страница Google+',
'Hide year in profile' => 'Скрыть год рождения в профиле',
'Lastname' => 'Фамилия',
'Last name' => 'Фамилия',
'LinkedIn URL' => 'Страница LinkedIn',
'MSN' => 'MSN',
'Male' => 'Мужской',

View File

@ -63,7 +63,7 @@ class Profile extends \yii\db\ActiveRecord
{
$rules = [
[['user_id'], 'required'],
[['user_id'], 'integer']
[['user_id'], 'integer'],
];
foreach (ProfileField::find()->all() as $profileField) {
@ -109,13 +109,13 @@ class Profile extends \yii\db\ActiveRecord
/**
* Internal
*
*
* Just holds message labels for the Yii Message Command
*/
private function translationOnly()
{
Yii::t('UserModule.models_Profile', 'Firstname');
Yii::t('UserModule.models_Profile', 'Lastname');
Yii::t('UserModule.models_Profile', 'First name');
Yii::t('UserModule.models_Profile', 'Last name');
Yii::t('UserModule.models_Profile', 'Title');
Yii::t('UserModule.models_Profile', 'Street');
Yii::t('UserModule.models_Profile', 'Zip');
@ -159,7 +159,8 @@ class Profile extends \yii\db\ActiveRecord
{
$labels = [];
foreach (ProfileField::find()->all() as $profileField) {
$labels = array_merge($labels, $profileField->fieldType->getLabels());
/** @var ProfileField $profileField */
$labels = array_merge($labels, $profileField->getFieldType()->getLabels());
}
return $labels;
}
@ -193,7 +194,7 @@ class Profile extends \yii\db\ActiveRecord
);
foreach (ProfileField::find()->orderBy('sort_order')->where(['profile_field_category_id' => $profileFieldCategory->id])->all() as $profileField) {
/** @var ProfileField $profileField */
$profileField->editable = true;
if (!in_array($profileField->internal_name, $safeAttributes)) {

View File

@ -9,6 +9,7 @@
namespace humhub\modules\user\models;
use humhub\components\ActiveRecord;
use humhub\modules\user\models\fieldtype\BaseType;
use Yii;
use yii\db\ActiveQuery;
@ -42,7 +43,7 @@ class ProfileField extends ActiveRecord
/**
* Field Type Instance
*
* @var type
* @var BaseType
*/
private $_fieldType = null;
@ -137,7 +138,7 @@ class ProfileField extends ActiveRecord
/**
* Returns the ProfileFieldType Class for this Profile Field
*
* @return ProfileFieldType
* @return BaseType
*/
public function getFieldType()
{

View File

@ -34,6 +34,7 @@ use humhub\modules\space\models\Space;
* @property string $last_login
* @property integer $visibility
* @property integer $contentcontainer_id
* @property Profile $profile
*/
class User extends ContentContainerActiveRecord implements \yii\web\IdentityInterface, \humhub\modules\search\interfaces\Searchable
{
@ -201,7 +202,7 @@ class User extends ContentContainerActiveRecord implements \yii\web\IdentityInte
/**
* @inheritdoc
*
* @return ActiveQueryContent
* @return \humhub\modules\content\components\ActiveQueryContent
*/
public static function find()
{