Tuesday, February 19, 2013

OpenWaves.EPiServer.Localization: Strongly typed access to EPiServer language files

Recently Making Waves released OpenWaves.EPiServer.Localization NuGet package. It provides strongly typed access to EPiServer lang. Now you can use:
string text = TranslationKeys.MyPage.MyCategory.Intro.GetString();

// instead of
// string text = LocalizationService.Current.GetString("/myPage/myCategory/intro");

UPDATE: EPiServer 6 & 7 supported

Localization package support both EPiServer 6 & 7. To change version change Resources\TranslationKeys.tt

<#@ import namespace="OpenWaves.EPiServer.Localization.Transformations" #>

    var epiServerVersion = 7;
    // for EPiServer 6.x version    
    // var epiServerVersion = 6;

  • Intelli Sense support
  • Compile time check for correct language keys
  • When refactoring all occurrences are renamed
  • Supports "Find all usages" of language keys

  1. Add NuGet package OpenWaves.EPiServer.Localization

  2. It's ready to use!

NOTE: After changing language file (*.xml) you have to"Run Custom Tool" manually to regenerate translation key classes


Vro said...

Great work. I can evaluate the efforts, because I was working on a kind of the same thing recently: https://github.com/SergVro/Localization-T4, but never had enough time to finish and make it public.

I also have a bug report for you :) It is an edge case issue, but still - if translation key has repetitive parts (like "/admin/tinymce/plugins/epiaccesskeysremove/epiaccesskeysremove") the generated code does not compile.

Mirosław Jedynak said...

Thanks for comment. I have fixed this issue.

I have also added Support for EPiServer 6

Valdis Iljuconoks said...

This is nice plugin! Thanks.

Jose Leal said...


I know this is an old post but though I really like the idea of this (all yours) plugins, I am also running into trouble using the localization plugin.
Namely there is no intellisense in visual studio 2010.
Can you help,please?