Open piotrpog opened 6 years ago
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,
@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 :)
Hi @piotrpog
Could you please share a better example? I'm not sure if I follow your requirement
Best,
@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.
Hi @piotrpog
When you say translation files (inside translaion folder) did you mean .php or .twig files?
@sarianth
I mean php files inside translations
directory. Now it just scans twig files in templates
directory.
+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.
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}}