maciejkrol/wikidiki
Composer 安装命令:
composer require maciejkrol/wikidiki
包简介
WikiDiki lets you translate words (mostly nouns) across multiple languages based on wikipedia.org
README 文档
README
WikiDiki uses Wikipedia to translate words across multiple languages.
Installation
You can install the library using composer.
composer require maciejkrol/wikidiki
Basic usage
WikiDiki usage is super simple.
//instantiate $wikidiki = new \maciejkrol\wikidiki\wikidiki ();
When translating you must tell WikiDiki what is the base language. English in this case. WikiDiki uses ISO two letter language codes.
This way you will get all the available translations as an associative array with the language codes as keys.
$word = 'Tea'; $language = 'en'; $translated = $wikidiki->translate($word, $language); //array
You can also provide a third argument, a string with a single language code to get a single translated string.
$word = 'Tea'; $language = 'en'; $to = 'pl'; $translated = $wikidiki->translate($word, $language, $to); //string
or an array to retrieve an array of translations.
$word = 'Tea'; $language = 'en'; $to = ['pl', 'it']; $translated = $wikidiki->translate($word, $language, $to); //array
In case WikiDiki can't find a translation null will be returned;
From now on you can get search suggestions:
$word = 'Tea'; $language = 'en'; $translated = $wikidiki->suggest($word, $language, $to); //array
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-19