Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig variable containing all translations #21

Open
piotrpog opened this issue Jan 9, 2019 · 2 comments
Open

Twig variable containing all translations #21

piotrpog opened this issue Jan 9, 2019 · 2 comments
Assignees
Labels
assingned question Further information is requested

Comments

@piotrpog
Copy link

piotrpog commented Jan 9, 2019

Sometimes I need to trasfer craft translation strings from twig to js. Unfortunetly i have to declate each string manually, like this:

var js_variable = '{{'craft_language_string'|t}}';

So, can you create Twig variable that would contain all translations for current language, so i can loop trought them?

@missmatsuko
Copy link

I think this should be possible in Craft and Twig already by looping through all the locales and getting that translation.

I'm not sure the exact syntax, but Craft's doc for |t links to Yii's docs for t() which has a parameter for $language.

@andrelopez andrelopez self-assigned this Jan 12, 2019
@andrelopez andrelopez added the question Further information is requested label Jan 12, 2019
@piotrpog
Copy link
Author

@missmatsuko I searched around a bit and didn't found a way to loop through translations without using a plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assingned question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants