Giter Site home page Giter Site logo

bartoszkubicki / magento2-polish-noun-numeral-declension-adapter Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 23 KB

Magento2 polish noun numeral declension adapter

License: MIT License

PHP 100.00%
magento2 magento2-module magento2-extension magento translation declension functions i18n

magento2-polish-noun-numeral-declension-adapter's Introduction

BKubicki Magento 2 Polish nouns numeral declension adapter

Overview

Magento 2 adapter for library bkubicki/magento2-polish-noun-numeral-declination-adapter

Usage

__p returns phrase with count argument. If we have all strings in store in english and we translate them onto other languages (as we should), for words that needs numeral declension, we should provide distinctive strings even in english, so translation will pick proper declension in polish. For example for word comment:

For en_US.csv:

"comment","comment"
"comments","comments"
"comments-g","comments"

For pl_PL.csv it should look like:

"comment","komentarz"
"comments","komentarzy"
"comments-g","komentarze"

and in phtml usage will be like

<?= __p($count, 'comment', 'comments', 'comments-g') ?>

Drawback of this approach may be necessity of keeping en_US translation, but magento provides it out of the box. Although, special, numeral noun declension doesn't seem to be common and will be used only from time to time.

Prerequisites

  • Magento 2.2/2.3+
  • PHP 7.2/7.3

Installation

To install the extension use the following commands:

 composer require bkubicki/magento2-polish-noun-numeral-declination-adapter

Tests

Unit

  1. Run command
./vendor/bin/phpunit -c phpunit.xml --testsuite "Unit" --coverage-html coverage/coverage-html --colors=always
  1. You can also use some alias:
  • test-unit-coverage - vendor/bin/phpunit -c phpunit.xml --testsuite "Unit" --coverage-html coverage/coverage-html --colors=always

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.