bkubicki / magento2-polish-noun-numeral-declension-adapter
Magento 2 适配波兰名词数格变化库
1.0.0
2020-05-10 16:17 UTC
Requires
- php: ^7.2.0|~7.3.0
- bkubicki/polish-noun-numeral-declension: ^1.0
- magento/framework: ^101.0|^102.0
Requires (Dev)
- phpunit/phpunit: ^8.0.0
This package is auto-updated.
Last update: 2024-09-11 02:32:16 UTC
README
概述
Magento 2 适配库 bkubicki/magento2-polish-noun-numeral-declination-adapter
用法
__p
返回带有计数参数的短语。如果我们把商店里的所有字符串都保存在英语中,并将其翻译成其他语言(我们应该这样做),对于需要数格变化的单词,即使在英语中,我们也应该提供独特的字符串,以便翻译可以正确选择波兰语中的数格。例如对于单词 comment
对于 en_US.csv
"comment","comment"
"comments","comments"
"comments-g","comments"
对于 pl_PL.csv 应该如下所示
"comment","komentarz"
"comments","komentarzy"
"comments-g","komentarze"
并且在 phtml 中的使用方式如下
<?= __p($count, 'comment', 'comments', 'comments-g') ?>
这种方法的缺点可能需要保留 en_US 翻译,但 Magento 提供了这种功能。尽管如此,特殊的数词名词变化似乎并不常见,并且只会偶尔使用。
先决条件
- Magento 2.2/2.3+
- PHP 7.2/7.3
安装
要安装此扩展,请使用以下命令
composer require bkubicki/magento2-polish-noun-numeral-declination-adapter
测试
单元测试
- 运行命令
./vendor/bin/phpunit -c phpunit.xml --testsuite "Unit" --coverage-html coverage/coverage-html --colors=always
- 您还可以使用一些别名
test-unit-coverage
-vendor/bin/phpunit -c phpunit.xml --testsuite "Unit" --coverage-html coverage/coverage-html --colors=always
版本控制
我们使用 SemVer 进行版本控制。有关可用的版本,请参阅此存储库的标签。
作者
许可
本项目采用 MIT 许可证 - 有关详细信息,请参阅 LICENSE 文件。