企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 创建翻译 > data/language/zh_CN.po ~~~ msgid "" msgstr "" "Project-Id-Version: URLNK.COM\n" "POT-Creation-Date: 2017-05-27 23:14+0800\n" "PO-Revision-Date: 2018-09-13 15:48+0800\n" "Language-Team: contact@urlnk.com\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.1.1\n" "X-Poedit-Basepath: .\n" "Plural-Forms: nplurals=1; plural=0;\n" "Last-Translator: \n" "Language: zh_CN\n" "X-Poedit-KeywordsList: haha\n" # 注释 msgid "Home" msgstr "主页" msgid "Album" msgstr "专辑" # msgid "Skeleton Application" msgstr "骨架应用" msgid "Blog" msgstr "博客" msgid "Add" msgstr "添加" msgid "Edit" msgstr "编辑" msgid "Delete" msgstr "删除" msgid "My albums" msgstr "我的专辑" msgid "Add new album" msgstr "添加新专辑" msgid "Album title" msgstr "专辑标题" msgid "Artist" msgstr "艺术家" msgid "Title" msgstr "标题" msgid "Edit album" msgstr "编辑专辑" msgid "Delete album" msgstr "删除专辑" msgid "Yes" msgstr "是" msgid "No" msgstr "否" msgid "Are you sure that you want to delete" msgstr "您确定想要删除" ~~~ 然后用 [Poedit](https://poedit.net/) 编译成 mo 文件 > data/language/zh_CN.mo **全局配置翻译** > config/autoload/global.php ~~~ 'translator' => [ 'locale' => 'zh_CN', 'translation_file_patterns' => [ [ 'type' => 'gettext', 'base_dir' => getcwd() . '/data/language', 'pattern' => '%s.mo', ], ], ], ~~~ ### 模板中翻译字符串 ~~~ <p>&copy; 2016 by Examples Ltd. <?= $this->translate('All rights reserved') ?></p> ~~~ ### 翻译源类型 `gettext`, `phparray`, `ini` > module/Blog/language/zh_CN.php ~~~ <?php return [ 'Blog Posts' => '博客文章', 'Add a blog post' => '添加一篇博客文章', 'Edit blog post' => '编辑博客文章', 'Cancel' => '取消', 'Post Title' => '文章标题', 'Post title' => '文章标题', 'Post Text' => '文章文本', 'Post content' => '文章内容', 'Post Details' => '文章详情', 'Write new post' => '写新文章', 'Insert new post' => '插入新文章', 'Update post' => '更新文章', 'Delete post' => '删除文章', 'Are you sure you want to delete the following post?' => '你确定想要删除这篇文章?', ]; ~~~ **模块配置翻译** > module/Blog/config/module.config.php ~~~ 'translator' => [ 'locale' => 'zh_CN', 'translation_file_patterns' => [ [ 'type' => 'phparray', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.php', ], ], ], ~~~