Categories

Featured templates

WooCommerce. 如何添加主题本地化

Amina Freinger April 20, 2015
Rating: 5.0/5. From 1 vote.
Please wait...

本教程将向您展示如何添加主题 localization in WooCommerce.

Preparation

Before adding theme localization, WordPress需要被告知它应该在哪种语言下运行. 请执行以下步骤:

  1. 要在WordPress中更改语言,您需要达到 wp-config.php file. 这个文件位于根目录中 directory 在你的服务器上安装WordPress.

  2. Open wp-config.php 文件和修改行 "define ('WPLANG', ");",如果文件中缺少,也可以添加. Insert your locale into the quotes. For example, 如果你想把你的网站翻译成德语, 你应该这样编辑这一行:

    定义(“WPLANG”、“de_DE”);  
    

    注意:您可以在 the following link.

  3. 然后在wordpress管理面板中导航到 Settings -> General 菜单和底部(在那里你可以看到 Site Language)选择您插入的语言 locale for. 不要忘记保存更改:

    woocommerce_add_theme_localization1

请随意查看详细教程: WordPress. 如何改变网站语言(从WordPress 4开始).

添加主题本地化

WooCommerce comes localization 开箱即用-所有需要的是你的翻译.

Poedit 是一个免费的程序,你可以用它来写翻译吗 software 或使用Gettext的网站 localization – like WordPress. WordPress使用PO文件的一切:WordPress核心,主题和插件.

  1. Go to http://www.poedit.net/download.php and download Poedit 适用于您的操作系统(windows /MAC).

  2. 在您的计算机上安装它:双击下载的文件并按照建议的步骤操作. 在安装结束时,请确保 安装后打开Poedit 选项选中后单击 Finish.

  3. WooCommerce自带2个POT文件,可以导入PoEdit进行翻译:

    • woocommerce.pot – contains frontend strings;

    • woocommerce-admin.pot -包含管理字符串.

    这些文件被分解成 frontend more efficient.

    Connect to your FTP account or open File Manager of the Hosting Control Panel and go to wp-content /插件/ woocommerce i18n /语言 directory. You will find woocommerce.pot and woocommerce-admin.pot files there. 把它们下载到你的电脑上.

  4. 每个文件分别被翻译. 要开始,打开已安装的PoEdit,导航到 File -> New from POT/PO file… 菜单并选择woocommerce.Pot或woocommerce-admin.pot file:

    woocommerce_add_theme_localization2

  5. In the appeared Translation Language 窗口选择您要添加翻译的语言:

    woocommerce_add_theme_localization3

  6. 在左侧列中查找要翻译的文本字符串 Source Text. You can hit Ctrl + F 热键查找特定的文本字符串.

    woocommerce_add_theme_localization4

  7. 单击要选择的文本字符串. It will appear in the Source Text lower field. Change the text in the Translation bottom field:

    woocommerce_add_theme_localization5

  8. 完成后,单击 Save button. 系统将提示您保存 .po 根据你要翻译的内容来命名它, for example, DE翻译应该保存为 woocommerce-de_DE.po or woocommerce-admin-de_DE.po respectively.

    The .mo 文件将自动生成.

  9. Upload both .po and .mo files to the wp-content /语言/ woocommerce / directory on your server using FTP software or File Manager. If you don’t have woocommerce folder under wp-content/languages directory, please create it.

    注意:如果您保留自定义翻译 woocommerce i18n /语言 (WooCommerce 2.2+ version) directory,它们可能在WooCommerce升级后丢失. 为了让它们安全升级,把它们放在 wp-content /语言/ woocommerce /. 所有翻译将自动添加到 wp-content /语言/ woocommerce / with WooCommerce 2.2+ version.

  10. 现在刷新您的网站,检查您在Poedit中更改的文本字符串现在是否在您的网站上更新了.

更多关于WooCommerce的信息 Localization can be found on the WooCommerce官网.

本教程到此结束. 现在你知道如何添加主题了 localization in WooCommerce.

请随时查看下面的详细视频教程:

WooCommerce. 如何添加主题本地化

很棒的Wordpress模板
这个条目被张贴了出来 WooCommerce Tutorials and tagged localization, theme, WooCommerce. Bookmark the permalink.

Submit a ticket

如果您仍然无法找到关于您的问题的足够的教程,请使用以下链接向我们的技术支持团队提交请求. 我们将在接下来的24小时内为您提供我们的帮助和协助: Submit a ticket