Project

General

Profile

WString::tr with Locale var/name for this one call

Added by Christian Meyer 7 days ago

I am looking for a way to set a specific Version of a Text for a single use of a ::tr call.

Background is as follows:

Just Legal Reasons unfortunately.
I want to show the Terms of Service in the "Service Provider Language". Meaning the Legally binding one of my Jurisdiction.
I also want to provide a translated Variant for convenience, with a hint that only the original is legally binding.
I already have the Text in my jurisdictional language, within my Language Resource file.

So instead of having to keep a copy of the "original" juridictional language within the default language pack (which is a different language, i.e. english) I want to use the one in the specified resource bundle.

for example:

I currently have to call tr("text.Legal.TOS") and tr("text.Legal.TOS.DE") and hold both keys within the default resource bundle.
What I would like to do instead to be able to set the special localization once like so: tr("text.Legal.TOS", "de")

I do not want to change the locale for everything, just for a single function call, where I now what locale to use.

This is also a Usability topic: I only want the Text once. Because if I am not the one updating the Legal Text, and there is a mixup or one part is forgotten, there might be mad consequences.

I did not look into it yet, and if there is an easy way to do this ...

I know this is a very specialized use case but I would like to hear your opinions.


Replies (1)

RE: WString::tr with Locale var/name for this one call - Added by Christian Meyer 7 days ago

Found a Solution

Code

    (1-1/1)