zoukankan      html  css  js  c++  java
  • Yii2.0实现语言包切换功能

    在yii2.0高级模板框架中,以前台为例,首先  在前台frontend 下面建立  messages/zh-CN 
    在 messages文件夹中创建一个文件:  ①common.php                                                     
    如果是使用的后台目录,就在  backend/config/main.php 中添加如下的配置文件
    return  [
                         'language'=>'zh-CN',//选择中文语言包
            ......        
                             components =>[ 
                             'i18n'=>[
     'translations'=>[
                                  '*' =>[
                         'class'=>'yiii18nPhpMessageSource',
                         'fileMap'=>[
                                        'common'=>'common.php'
                                                               ]
                                                     ]
                               ]
    ]
                       ],
    ]
    添加language和i18n之后,基本上已经完成
     
    在common.php 中添加peizhi.png
     

    在说出页面展示即可

    main.png
         如果出现index.png
    就代表成功
  • 相关阅读:
    SQL SEREVR IO
    INTEL
    windows performance
    The DiskSpd Storage Performance Tool
    machine Learning
    NOSQL
    X64 Deep Dive
    Debugging and performance,ETW
    Disk Performance
    WCF transport-and-message-security
  • 原文地址:https://www.cnblogs.com/liuzhen123/p/8059335.html
Copyright © 2011-2022 走看看