Kdyby / Translation

Integration of Symfony/Translation into Nette Framework
https://packagist.org/packages/kdyby/translation
Other
89 stars 84 forks source link

Plural not working #153

Open Isigar opened 6 years ago

Isigar commented 6 years ago

Hello, i have simple project where i use this package and i cant get working variant of plural translation...

Composer

{
    "name": "nette/sandbox",
    "description": "The sandbox is a pre-packaged Nette Framework project, basic configured structure for your application.",
    "homepage": "https://nette.org",
    "type": "project",
    "license": ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
    "authors": [
        {
            "name": "David Grudl",
            "homepage": "https://davidgrudl.com"
        },
        {
            "name": "Nette Community",
            "homepage": "https://nette.org/contributors"
        }
    ],
    "require": {
        "php": ">=5.6.0",
        "nette/application": "^2.4.4",
        "nette/bootstrap": "^2.4.3",
        "nette/caching": "^2.5",
        "nette/database": "^2.4",
        "nette/di": "^2.4",
        "nette/finder": "^2.4",
        "nette/forms": "^2.4",
        "nette/http": "^2.4",
        "nette/mail": "^2.4",
        "nette/robot-loader": "^2.4 || ^3.0",
        "nette/safe-stream": "^2.3",
        "nette/security": "^2.4",
        "nette/utils": "^2.4",
        "latte/latte": "^2.4",
        "tracy/tracy": "^2.4",
        "dg/adminer-custom": "^1.9",
        "kdyby/doctrine": "^3.3",
        "ublaboo/datagrid": "^5.5",
        "kdyby/translation": "^2.5"
    },
    "require-dev": {
        "nette/tester": "^2.0"
    },
    "minimum-stability": "stable",
    "config": {
        "platform": {
            "php": "5.6"
        }
    }
}

Translate file

dashboard:
    from: Od
    to: Do
    left: "Zbývající čas"
    lower_day: "Méně než den"
    day: "den|%count% dní"
    month: "1 měsíc|%count% měsíců"
    year: "1 rok|%count% roky"

Everything work only plural not. Its show full string but placeholder changed by value that i set

Use in presenter

{_page.dashboard.year, ["count" => $diff->y]}
i tested both
{_page.dashboard.year, $diff->y}

Thanks for any response & sorry for my bad english :)

lulco commented 5 years ago

try this:

day: "{1} den|[2,Inf] %count% dní