Laravel 6.8 resources auth 本地化 簡體中文

tdhao888發表於2018-11-12

laravel 5.7 resources 簡體中文 本地化
建立目錄:resources/lang/zh-CN
按以下內容建立檔案,並將內容複製到檔案中
修改 config/app.php

'locale' => 'zh-CN',
// auth.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are used during authentication for various
    | messages that we need to display to the user. You are free to modify
    | these language lines according to your application's requirements.
    |
    */

    'failed' => '輸入的賬號不存在', # These credentials do not match our records.
    'throttle' => '登入太頻繁,請 :seconds 秒後重試。',

];
// pagination.php
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Pagination Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are used by the paginator library to build
    | the simple pagination links. You are free to change them to anything
    | you want to customize your views to better match your application.
    |
    */

    'previous' => '上一頁(&L)',
    'next' => '下一頁(&R);',

];
// passwords.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Password Reset Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are the default lines which match reasons
    | that are given by the password broker for a password update attempt
    | has failed, such as for an invalid token or invalid new password.
    |
    */

    'reset' => '您的密碼已重置!',
    'sent' => '已透過電子郵件傳送了您的密碼重置連結!',
    'throttled' => '請稍候重試。',
    'token' => '當前密碼重置的令牌已失效。',
    'user' => "未找到與此郵箱匹配的使用者。",

];
// validation.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Validation Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines contain the default error messages used by
    | the validator class. Some of these rules have multiple versions such
    | as the size rules. Feel free to tweak each of these messages here.
    |
    */

    'accepted' => ':attribute 必須接受',
    'active_url' => ':attribute 不是有效的 URL',
    'after' => ':attribute 必須是 :date 之後的日期',
    'after_or_equal' => ':attribute 必須是小於或等於 :date 的日期',
    'alpha' => ':attribute 只允許包含字母',
    'alpha_dash' => ':attribute 只允許包含字母、數字、括折號和下劃線',
    'alpha_num' => ':attribute 只允許包含字母和數字',
    'array' => ':attribute 必須是陣列',
    'before' => ':attribute 必須是 :date 之前的日期',
    'before_or_equal' => ':attribute 必須早於或等於 :date 的日期',
    'between' => [
        'numeric' => ':attribute 必須大於 :min 並且小於 :max 的數值',
        'file' => ':attribute 必須大於 :min 並且小於 :max KB',
        'string' => ':attribute 必須大於 :min 並且小於 :max 個字元',
        'array' => ':attribute 必須大於 :min 並且小於 :max 項',
    ],
    'boolean' => ':attribute 必須是 true 或 false',
    'confirmed' => 'The :attribute confirmation does not match.',
    'date' => ':attribute 不是有效的日期型別',
    'date_equals' => ':attribute 必須等於 :date',
    'date_format' => ':attribute 的格式與 :format 不匹配。',
    'different' => ':attribute 和 :other 不能相同。',
    'digits' => ':attribute 必須是 :digits 位數',
    'digits_between' => ':attribute 必須是 :min ~ :max 位數。',
    'dimensions' => ':attribute 的尺寸不在限定範圍內',
    'distinct' => ':attribute 存在相同的值',
    'email' => ':attribute 必須是有效的電子郵箱地址',
    'ends_with' => ':attribute 必須以 :values 結尾',
    'exists' => '當前選定的 :attribute 無效',
    'file' => ':attribute 必須是一個檔案',
    'filled' => ':attribute 必須輸入一個值',
    'gt' => [
        'numeric' => ':attribute 必須大於 :value',
        'file' => ':attribute 必須大於 :value KB',
        'string' => ':attribute 必須大於 :value 個字元',
        'array' => ':attribute 必須選定 :value 個選項',
    ],
    'gte' => [
        'numeric' => ':attribute 必須大於或等於 :value',
        'file' => ':attribute 必須大於或等於 :value KB',
        'string' => ':attribute 必須大於或等於 :value 個位元組',
        'array' => ':attribute 必須包含 :value 個以上的選項',
    ],
    'image' => ':attribute 必須是一個影像',
    'in' => '選定的 :attribute 是無效值',
    'in_array' => ':attribute 不在 :other 中',
    'integer' => ':attribute 必須是整數',
    'ip' => ':attribute 必須是一個有效的 IP 地址',
    'ipv4' => ':attribute 必須是一個有效的 IPv4 地址',
    'ipv6' => ':attribute 必須是一個有效的 IPv6 地址',
    'json' => ':attribute 必須是一個有效的 JSON 字串',
    'lt' => [
        'numeric' => ':attribute 必須小於 :value',
        'file' => ':attribute 必須小於 :value KB',
        'string' => ':attribute 必須小於 :value 個字元',
        'array' => ':attribute 必須小於 :value 個選項',
    ],
    'lte' => [
        'numeric' => ':attribute 必須小於或等於 :value.',
        'file' => ':attribute 必須小於或等於 :value KB',
        'string' => ':attribute 必須小於或等於 :value 個字元',
        'array' => ':attribute 不能超過 :value 個選項',
    ],
    'max' => [
        'numeric' => ':attribute 不能大於 :max',
        'file' => ':attribute 不能大於 :max KB',
        'string' => ':attribute 不能大於 :max 個字元',
        'array' => ':attribute 不能大於 :max 個選項',
    ],
    'mimes' => ':attribute 的型別必須是: :values',
    'mimetypes' => ':attribute 的型別必須是: :values',
    'min' => [
        'numeric' => ':attribute 不能小於 :min',
        'file' => ':attribute 不能小於 :min KB',
        'string' => ':attribute 不能小於 :min 個字元',
        'array' => ':attribute 不能小於 :min 個選項',
    ],
    'not_in' => '選項 :attribute 無效',
    'not_regex' => ':attribute 格式無效',
    'numeric' => ':attribute 必須是數值',
    'password' => '密碼錯誤',
    'present' => ':attribute 必須存在',
    'regex' => ':attribute 格式無效',
    'required' => ':attribute 必須填寫',
    'required_if' => '當 :other 等於 :value 時 :attribute 必須填寫',
    'required_unless' => '如果 :values 包含 :other 則必須輸入 :attribute 的值',
    'required_with' => '如果 :values 存在時,則必須輸入 :attribute 的值',
    'required_with_all' => '如果 :values 存在時,則必須輸入 :attribute 的值',
    'required_without' => '如果 :values 不存在時,則必須輸入 :attribute 的值',
    'required_without_all' => '如果 :values 沒有值,則必須輸入 :attribute 的值',
    'same' => ':attribute 和 :other 必須匹配',
    'size' => [
        'numeric' => ':attribute 必須是 :size.',
        'file' => ':attribute 必須是 :size KB',
        'string' => ':attribute 必須是 :size 個位元組',
        'array' => ':attribute 必須選定 :size 個選項',
    ],
    'starts_with' => ':attribute 必須以: :values 開頭',
    'string' => ':attribute 必須是字串',
    'timezone' => ':attribute 必須是有效的區域',
    'unique' => ':attribute 已存在',
    'uploaded' => ':attribute 上傳失敗',
    'url' => ':attribute 格式無效',
    'uuid' => ':attribute 必須是一個有效的 UUID',

    /*
    |--------------------------------------------------------------------------
    | Custom Validation Language Lines
    |--------------------------------------------------------------------------
    |
    | Here you may specify custom validation messages for attributes using the
    | convention "attribute.rule" to name the lines. This makes it quick to
    | specify a specific custom language line for a given attribute rule.
    |
    */

    'custom' => [
        'attribute-name' => [
            'rule-name' => 'custom-message',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Custom Validation Attributes
    |--------------------------------------------------------------------------
    |
    | The following language lines are used to swap our attribute placeholder
    | with something more reader friendly such as "E-Mail Address" instead
    | of "email". This simply helps us make our message more expressive.
    |
    */

    'attributes' => [],

];
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章