2015年4月1日 星期三

WooCommerce上的中文化設定--Translating WooCommerce (Localization)




    部落格,在如今不單單是只能寫寫文章、放放圖片、影片,分享你所喜愛的事物。

在使用網路已習以為常的現在---部落格,還能賣東西!!




    在國外,WordPress是相當多數人所愛用的網誌軟體。

其所使用的人數之多,導致有許許多多的廠商,開發各式各樣的應用程式(外掛)。


WooCommerce是國外很有名的免費購物車應用程式,其應用架構在WordPress上。

所以,

WooCommerce+WordPress= Free Online Shopping Cart



廢話不多說,本篇主題,是教人中文化WooCommerce。

這資料,是從國外來的。(大概是台灣很少人用)

在此跟大家分享。(因為版主懶得翻譯了,請大家自己看)

資料來源:
http://docs.woothemes.com/document/woocommerce-localization/

Translating WooCommerce (Localization)


Introduction↑ Back to Top

WooCommerce comes localization ready out of the box – all that’s needed is your translation, if the plugin does not come bundled with one for your language.
There are several methods to create a translation, most of which are outlined in theWordPress Codex. However, we find the easiest method is to use a plugin called codestyling localization. More advanced users can use PoEdit. Both methods are covered in this doc.

Before you begin↑ Back to Top

WooCommerce includes a language file (.po or .pot file) which contains all of the English text. You can find this language file inside the plugin folder in woocommerce/i18n/languages/.

Set up WordPress↑ Back to Top

WordPress needs to be told which language it should run under.
  1. Go to: Dashboard > Settings > General and change the Site language.
Once this has been done, the shop will be displayed in your locale if the language file exists. Otherwise you need to create the language files (process explained below).

WooCommerce 2.2+ Language Packs↑ Back to Top

From version 2.2, WooCommerce includes a language pack downloader. PO and MO files will no longer be bundled with the plugin – they will be downloadable from your dashboard if you have the WPLANG constant set, or from a git repository if you wish to grab them manually. A notice will be displayed within your administration:
Update WooCommerce 2.2+ Translation Packs
Update WooCommerce 2.2+ Translation Packs
If for some reason the translation packs install fails, you can force the download in WooCommerce > System Status > Tools > Force Translation Upgrade:
Force Translation Upgrade (WooCommerce > System Status > Tools)
Force Translation Upgrade (WooCommerce > System Status > Tools)
PO and MO files are copied in wp-content/languages/plugins/

Translating with Codestyling Localization↑ Back to Top

Codestyling Localization is the method we recommend for most users as it is the simplest to setup.
You must download the Codestyling Localization plugin, which allows you to translate the plugin directly in the WP admin panel.
Install and activate the plugin and go to Tools > Localization (shown in your language), then follow the instructions on how to translate the plugin.

Codestyling Localization plugin allows for easy translation
Important: You can ignore the message in codestyling which states “Loading problem: Author is using load_textdomainem instead of load_plugin_textdomain.” We use both methods to ensure maximum compatibility.

Updating your translation

If you update your plugin to a new version which has an updated language file, you’ll need to rescan WooCommerce using the plugin and then translate the new strings. Find WooCommerce in Codestyling Localization plugin and click the Rescan link to have the plugin update the po file.

Update your PO file by rescanning the theme
After you have rescanned, click Edit to translate any new strings the plugin found when rescanning. Remember to generate a new MO file after you have translated your new strings.

Translating with PoEdit↑ Back to Top

PoEdit is a more advanced alternative to Codestyling Localization. Only advanced users or translators who wish to contribute to WooCommerce core should attempt this method.
WooCommerce comes with 2 POT files which can be imported into PoEdit to translate. These files are broken up to make the frontend more efficient.
  • woocommerce.pot – Contains frontend strings
  • woocommerce-admin.pot – Contains admin strings
Each is translated separately. To get started open PoEdit and go to File > New catalog from POT file. Once you have done this, choose either woocommerce.pot or woocommerce-admin.pot and PoEdit will show the catalog properties window:
Properties
Properties
Enter your name etc so other translators know who you are and click ‘ok’. After this you will be prompted to save your .po file – name it based on what you are translating to, for example, a GB translation would be saved as woocommerce-en_GB.po or woocommerce-admin-en_GB.po respectivelyNow the strings will be listed.
Translate the strings
Translate the strings
After translating all strings you can save – the .mo file will also be generated automatically.

Updating your translation

After updates, you can update your po file by opening it and then going to Catalog > Update from POT file. Choose the file and it will be updated accordingly.

Making your Localization upgrade safe↑ Back to Top

If you keep your custom translations in woocommerce/i18n/languages (WooCommerce < 2.2+) they can be lost when upgrading. To make them upgrade safe, instead place them inwp-content/languages/woocommerce/. All translations will be automatically added to wp-content/languages/woocommerce/ with WooCommerce 2.2+.
Note, once moved you cannot use Codestyling to edit your moved localizations – you need to move them back to make changes.

Contributing your Localization to Core↑ Back to Top

We maintain our translations through our project on Transifex. If you want to contribute translated strings to your language, or wish to start a new translation, request access to the project through Transifex and you can start translating as soon as possible.








沒有留言:

張貼留言