Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6470

Offer possibility to override template translations

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Do
    • Neutral
    • None
    • None
    • freemarker
    • None

    Description

      It's possible to override a messages in a FTL template by specifying a custom i18nbase.
      We could provide a different solution since the base name is deprecated.
      It could be a key generator in the MessageWrapper which would generated the keys:
      FTL: i18n[my.key]

      public String get(String key) {
              return translationService.translate(localeProvider, base name,  
                                     Components.getComponent(TemplateKeyGenerator.class).generate(key)});
      }
      
      class TemplateKeyGenerator {
           String[] generate(){
               return new String{key, site name + key};
           }
      }
      

      It would be possible to define a custom TemplateKeyGenerator via module descriptor. E.g. Site module would bring a SiteAwareTemplateKeyGenerator.
      Be aware that this is different than other info.magnolia.i18nsystem.I18nKeyGenerator s since those generates keys from nothing. Here we need to generated additional keys to the provided one.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                rkovarik Roman Kovařík
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD