Hi Jon, thanks for getting into the trouble of finding those links.
Let's see:
The first one is using a dictionary object to find out whether a node matches a list of values on one of its properties - there's no localization there.
The second one, while very interesting, again has nothing to do with messages localization.
The third one - while very interesting, it doesn't really apply to my case. I'm looking for a way to localize bubble messages that appear when events like publish etc. are hit.
The fourth one actually got me thinking. And, surprise, I thought of a way!
The problem is that front-end languages may not be the same as back-end languages, since the language preference in the back-end is per user and any user can pick any language for the back-end. So dictionary seemed to be out of the picture. That is, until you make the assumption that you have the same languages defined for the back and the front-end. In this case, something like the following works:
var d = ApplicationContext.Current.Services.LocalizationService.GetDictionaryItemByKey("MyMessage");
var literals = d.Translations.Where(x => x.Language.CultureInfo.TwoLetterISOLanguageName == System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName);
var literal = (literals!=null) ? literals.First().Value : "My default message";
e.CancelOperation(new EventMessage("Error", literal, EventMessageType.Error));
Localization of custom Event Messages in back end
Is there a way to localize Event Messages (former bubbles)? Like for example localize the category and message in the following:
Sotiris,
As noted on Slack, I would use a dictionary to handle the translations.
You might want to ask Matt Brailsford about Vorto too though, that might make things easier but I don't know as I've not used it.
Hope this helps nonetheless!
#h5yr
J
Sotiris,
A couple of links for you, and then I'm off to bed!
Hope these help!
Night night!
J
Hi Jon, thanks for getting into the trouble of finding those links.
Let's see:
The first one is using a dictionary object to find out whether a node matches a list of values on one of its properties - there's no localization there.
The second one, while very interesting, again has nothing to do with messages localization.
The third one - while very interesting, it doesn't really apply to my case. I'm looking for a way to localize bubble messages that appear when events like publish etc. are hit.
The fourth one actually got me thinking. And, surprise, I thought of a way!
The problem is that front-end languages may not be the same as back-end languages, since the language preference in the back-end is per user and any user can pick any language for the back-end. So dictionary seemed to be out of the picture. That is, until you make the assumption that you have the same languages defined for the back and the front-end. In this case, something like the following works:
Thanks for pointing me in the right direction!
is working on a reply...