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

Use all static message strings from translations directory #10

Open
piotrpog opened this issue Sep 25, 2018 · 7 comments
Open

Use all static message strings from translations directory #10

piotrpog opened this issue Sep 25, 2018 · 7 comments
Assignees
Labels
assingned question Further information is requested

Comments

@piotrpog
Copy link

Can plugin be modified so that it uses all strings used inside 'translations' directory, even if these are not directly used in templates?

Use case: to make dropdown fields labels multilingual, i use them as kays inside static messages translations files. So, no actual translation strings are directly used in template, but like this:
{{entry.dropdown_field.label|t}}

@andrelopez andrelopez self-assigned this Sep 28, 2018
@andrelopez andrelopez added the question Further information is requested label Sep 28, 2018
@andrelopez
Copy link
Member

Yes, but you need to create a private file in your templates e.g: _customTranslations.twig

In this file please add any translation that you want e.g the string from your dropdown fields:
templates\_customTranslations.twig

{{"label1"|t}}
{{"label2"|t}}
{{"label3"|t}}

Go to Enupal Translate and you'll see these translation strings as pending, select the language that you want to translate, add the translation, save it and go to the entry where you're using the field, switch the language that you want and you'll be able to see the translations.

Best,

@piotrpog
Copy link
Author

piotrpog commented Oct 1, 2018

@andrelopez Thanks for reply. Indeed, its possible to use this walkaround, but I was asking if it was possible to just implement this functionality in plugin :)

@andrelopez
Copy link
Member

Hi @piotrpog

Could you please share a better example? I'm not sure if I follow your requirement

Best,

@piotrpog
Copy link
Author

piotrpog commented Nov 1, 2018

@andrelopez
Sorry for not replying earlier.

Its just about where plugin should look for translation strings.
Currently it looks inside template files. I propose that it also checks translation files (inside translations folder) for any strings that are not currently used in templates.

@sarianth
Copy link

Hi @piotrpog

When you say translation files (inside translaion folder) did you mean .php or .twig files?

@piotrpog
Copy link
Author

@sarianth
I mean php files inside translations directory. Now it just scans twig files in templates directory.

@stevenvandemoortele
Copy link

+1 for adding support for translation files inside translation folder. I use freeform for most of my forms and the recommended translation method for form labels is creating a freeform.php translation file. Currently these files can't be translated using enupal translate.

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