Skip to content

Instantly share code, notes, and snippets.

@pierreboissinot
Last active January 7, 2018 15:51
Show Gist options
  • Save pierreboissinot/57099732ef8f629ea5563278470192ab to your computer and use it in GitHub Desktop.
Save pierreboissinot/57099732ef8f629ea5563278470192ab to your computer and use it in GitHub Desktop.
PhpStorm Symfony Translation Flow

PhpStorm Symfony Translation Flow

Basic Requirements

  • Symfony's translation service is enabled and configured doc
  • Translastion resources/files are createddoc

PhpStorm Configuration

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 like src/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.

Flow

  1. When you type a statement that use the sf translation service, move your cursor on your key ressource.
  2. Press Alt+Enter to display suggestions, select Symfony: Add translations suggestion and press Enter.
  3. Translations resource files should appear, select the one you want like src/AppBundle/Resources/translations/messages.fr.yml, hit Enter. Note that you can't select serval translation files, so repeat step 3 for each locale.
  4. On the key, press Alt+Enter and select the translation file to edit the value.

Recommandations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment