Jump to content

Language Translator Twig


justb3a
 Share

Recommended Posts

Adds twig support for language translator list.
 
To get your `.twig` files listed as well, you need to wrap the phrases like this:

{{ __('text to translate', 'filepath/filename relative to site/templates/') }}

{{ __('another text to translate', 'home') }}

{{ __('one more text to translate', 'partials/header') }}
  • first line - general usage
  • second line - example for a text in site/templates/home.twig
  • third line - example tor a text in site/templates/partials/header.twig

 

  • Like 6
Link to comment
Share on other sites

  • 11 months later...
  • 2 weeks later...
  • 1 month later...

After installing it crashes my site. I always get an error 500 (frontend and backend)

Error: Exception: You do not have permission to edit this language (in ......./web/wire/modules/LanguageSupport/ProcessLanguageTranslator.module line 79)

I was logged in as superuser.

What can I do?

Best regards

Edit: I deleted the files via FTP and now I can login as usual and the frontend will be displayed as expected

Link to comment
Share on other sites

Thanks for this report. I fixed this issue. Please test it using the latest version (get it from Github or ProcessWire module repository).

Furthermore I divided the initial module into two single modules:

  • LanguageTranslatorList to display and edit translation files. This works for twig files as well as for php files. So there is no TemplateTwigReplace dependency.
  • TemplateTwigReplaceLanguageSupport to add twig support for translations as well as enabling the Twig Intl Extension (optionally), requires TemplateTwigReplace and LanguageTranslatorList
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
 Share

×
×
  • Create New...