Jump to content

[1.7.4.2.] translating new variable in CartPresenter.php?


sting5

Recommended Posts

My language requires different words for certain plural values for products, so I've added this line of code in CartPresenter.php:

        $summary_string = $products_count === 1 ?
            $this->translator->trans('1 item', array(), 'Shop.Theme.Checkout') :
            $this->translator->trans('%count% items', array('%count%' => $products_count), 'Shop.Theme.Checkout')
        ;
<!-- new variable line -->
        $summary_string = $products_count === 2 ?
            $this->translator->trans('2 items', array(), 'Shop.Theme.Checkout') :
            $this->translator->trans('%count% items', array('%count%' => $products_count), 'Shop.Theme.Checkout')
        ;
<!-- end of new variable line -->

After that I wanted to translate the word "items" to correct representing word in my language, but the Translations page does not find it.

Maybe i'ts possible to manually add a code into {main_dir}\app\Resources\translations\lt-LT\ShopThemeCheckout.lt-LT.xlf somehow for this to work?

Link to comment
Share on other sites

  • 4 weeks later...

Unfortunately no - it seems that this code only works when there are 2 possible words - one plural, one singular. It does not take into account the fact that some languages may have few plural forms available, sadly.

Link to comment
Share on other sites

For what i read it's because prestashop doesnt look at any changes of a clasic theme so if u make any changes and put on "Shop.Theme.Checkout" is not going to find it.

I tried to made it go to another theme with "Shop.MyTheme" but than i got error whenever i was trying to find the translation of this theme...weird nobody ever found a solution 😕

Link to comment
Share on other sites

  • 1 month later...

It is because the new translation system in Prestashop is bugged and still in testing phase. But this topic is mean to search for a solution on different plural forms integration, translation is next step of this issue...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...