- Symfony's translation service is enabled and configured doc
- Translastion resources/files are createddoc
First, go to File > Settings > Languages & Frameworks > PHP > Symfony
.
- Check that the Symfony Plugin is enabled for the project.
- Check that the
Translation Root Path
settings is corrected, something likesrc/AppBundle/Resources/translations
.
If you modify your plugin settings but don't see any change, try to clear the index managed by the plugin by clicking on Clear Index
in Symfony Plugin Settings.
- When you type a statement that use the sf translation service, move your cursor on your key ressource.
- Press
Alt
+Enter
to display suggestions, selectSymfony: Add translations
suggestion and pressEnter
. - Translations resource files should appear, select the one you want like
src/AppBundle/Resources/translations/messages.fr.yml
, hitEnter
. Note that you can't select serval translation files, so repeat step 3 for each locale. - On the key, press
Alt
+Enter
and select the translation file to edit the value.
- Follow Symfny Best practises for naming translation keys
- If you follow this flow you should never edit a translation key in a translaton file, instead refactor the key where it is used.