Search code examples
serenity-platform

Serenity Platform; LocalText.Get("Db.something") in a specific language instead of selected language?


Currently (as of SF 3.14.3), on Server-side one can retrieve the language-specific translation of a "key" (in my example here this is "Db.something") for the - currently in the GUI selected - language.

As I am using Serenity now in a very special way (using it as a pure Web API (REST) backend without GUI, I want to retrieve the translation of a key by a "programmatically" given languageID.

Is there a way - similar to what LocalText.Get() is doing - but where I can specify the desired language (ID)?

Regards,

John


Solution

  • Try resolve ILocalTextRegistry for custom things.

    var registry = (LocalTextRegistry)Dependency.Resolve<ILocalTextRegistry>();
    registry.TryGet("en-US", "Db.Something");