Extend plugin languages

@Karmalakas, To add an extra translation for a plugin, you can do the following. Also see the docs about Translation Overrides.

Let’s add 'Italian to the plugin:

  • Lookup the string from the plugin you want to override. Eg from plugin ‘Test’ look in file user/plugins/test/languages.yaml:
    en:
      PLUGIN_TEST:
        TEXT_VARIABLE: Text Variable
        TEXT_VARIABLE_HELP: Text to add to the top of a page
    
  • Create file user/languages/it.yaml
  • Copy the following into the new file:
    PLUGIN_TEST:
      TEXT_VARIABLE: <Translation in Italian>
      TEXT_VARIABLE_HELP: <Translation in Italian>
    
  • Add language it to user/config/system.yaml:
    languages:
      supported: [en, it]
    
  • If plugin Test has the snippet {{ 'PLUGIN_TEST.TEXT_VARIABLE' | t }} in a template , it will be translated into Italian when you browse to the Italian version of the page.
1 Like