Jump to content

New translation system - translations never displayed


Recommended Posts

Hey,

I'm trying to use the new translation system on PS 8.1. The only way I got it working ever is using array with $this->l in module and hardcoding values, but that does not seem reasonable, so I tried the new one.

I am using for example this in my forms extending TranslatorAwareType:

'label' => $this->trans('External reference', TranslationDomain::TRANSLATION_DOMAIN_ADMIN)

Controller:

$this->addFlash('success', $this->trans('Entity delete was successfull', TranslationDomain::TRANSLATION_DOMAIN_ADMIN));

(I also tried hardcoding the domain string. In twig I use hardcoded strings, as Presta would not scan variables).

{{ 'Entity'|trans({}, 'Modules.Mymodule.Admin') }}

Domain is: Modules.Mymodule.Admin

The problem is that I can see the translations in admin, I can seemingly translate to another languages.

Steps:

  • Translate in admin -> module translations
  • Delete cache in back office, several times
  • Delete cache manually
  • Verify that translation is saved (load module trans again)
  • ... Delete cache like hundred times, switch browser to ensure no browser cache is used
  • Strings are shown in english only

 

Yet the only thing I can see is english. Other strings, like menu etc, is in correct language - the context is correct. 

public function isUsingNewTranslationSystem() { return true; }

How do I correctly translate forms and twigs? The way from docs does not work.

 

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...