The API you are actually manipulating when you do this is https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html which is about languages and language variants.
getDisplayName return the display name for the whole Locale but you can get the language pretty name using getDisplayLanguage and the country pretty name with getDisplayCountry. So the trick would be to create a Locale with the country part in it and then call getDisplayCountry. Here is a few experiments for you: $services.localization.toLocale('it').getDisplayName('fr') $services.localization.toLocale('it_IT').getDisplayName('fr') $services.localization.toLocale('it_IT').getDisplayLanguage('fr') $services.localization.toLocale('it_IT').getDisplayCountry('fr') On Tue, May 17, 2016 at 5:10 PM, Gerritjan Koekkoek <gerrit...@cdlsworld.org> wrote: > I found a nice way to translate $language into pretty language name in the > translation desired. > > > {{velocity}} > > #displayLanguagePrettyName("it") > > #macro(displayLanguagePrettyName $language)#set($languageLocale = > $services.localization.toLocale("it"))$stringtool.capitalize($languageLocale.getDisplayName("nl"))#end > > {{/velocity}} > > > So changing the 'nl' to 'pt' (portugese) it will do > > Italiaans (dutch) -> Italiano (portugese) > > > Ca the same be done for country? > > Italië (dutch) -> Itália (Portuguse) > > > > > Gerritjan Koekkoek > Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS > Visit our website<http://www.cdlsworld.org> > Facebook<https://www.facebook.com/gerritjan.koekkoek> > email<gerrit...@cdlsworld.org> > > > > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users