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

Offer possibility to override template translations

XMLWordPrintable

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

      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.

        Acceptance criteria

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

                Created:
                Updated:
                Resolved:

                  Task DoD