项目作者: hoymultimedia

项目描述 :
A Polylang helper for WordPlate
高级语言: PHP
项目地址: git://github.com/hoymultimedia/polylang.git
创建时间: 2016-05-11T13:31:34Z
项目社区:https://github.com/hoymultimedia/polylang

开源协议:MIT License

下载


Polylang

A Polylang helper for WordPlate.

Build Status
StyleCI
Coverage Status
Latest Version
License

Installation

Require this package, with Composer, in the root directory of your project.

  1. $ composer require hoy/polylang

Login to the WordPress administrator dashboard and activate the Polylang plugin. Go to the Polylang settings page and add at least one language.

Usage

Register the translations with the pll_translations function. They will now be available for translation on the ‘Strings translations’ page in the WordPress administrator dashboard.

  1. pll_translations([
  2. 'group' => [
  3. 'String that should be translatable by Polylang' => 'Explanation of how the string is used',
  4. ],
  5. 'general' => [
  6. 'English' => 'The english language',
  7. 'Swedish' => 'The swedish language',
  8. ],
  9. 'cookie-bar' => [
  10. 'This website uses cookies to ensure you get the best experience on our website.' => 'Cookie bar message',
  11. 'I understand' => 'Cookie bar button text'
  12. ],
  13. ]);

Then to fetch and print a translation you can use the trans function like you would use regular __() function.

  1. echo trans('I understand');

Documentation

Please visit Polylang’s documentation to find out more about translating your post types.

License

MIT © Hoy Multimedia AB