Forcing a Locale

Well, this doesn’t help me, but in trying to solve this, I have discovered a problem…

Str(value, format) function doesn’t follow the “rules”.

Format(value, format) produces a string that is formatted with the locale settings.
Str(value, format) produces a string that is formatted without the locale settings.

[quote=470846:@Andy Broughton]Format(value, format) produces a string that is formatted with the locale settings.
Str(value, format) produces a string that is formatted without the locale settings.[/quote]
That is how it should be. From the Str Docs:

Here’s a much better way of dealing with this issue, assuming your client is on a Mac. Not many people know about this feature but you can tell macOS to treat specific apps as being in a different language/locale.

• Go to System Preferences > Language & Region and click the Apps tab.
• Add your built app to this list, choosing your required language/locale.

In the screenshot attached, I have added Server Ranger as a French language/locale app. Note that the system is still UK-English. Using this, you can make any app appear in the chosen language (assuming you’ve translated your Strings), along with correct formatting for dates, times and currencies.

I hope that helps.

I get that now. Norm explained it to me as well. Just unexpected.

I have more European Windows users than Mac.
I always figured Apple is more a NA phenomenon, but I haven’t really researched it…

If it’s helpful, there’s something similar on Windows, depending on the version. Try this on Windows 10 (it’s somewhere else on previous versions): Start > Settings > Time & Language > Language > Spelling, typings, & Keyboard Settings > Advanced Keyboard Settings > Let me use a different input method for each app window

We’re getting off topic but that’s a fair assumption about a NA company. However, their international Mac sales have taken more than 50% of their Mac revenue for many years, well over a decade at least.

What is a NA company, please ?

north american I assume from the context

[quote=470882:@Norman Palardy]north american I assume from the context[/quote]Oui.

Thanks.

Nota: Apple have a plant @ Cork (Ireland) since 1980-10 (4,5 years after Apple saw the light of day).

Ireland has been a great tax dodge for ages
Hence the name for it - the double Irish :slight_smile:

I worked for one company - which shall remain nameless - that had hundreds of subsidiaries for exactly the purpose Apple et al do - to move money around the world from one tax haven to another where they have favourable tax arrangements and pay as little tax as possible

All legal given the treaties that exist between the various countries

Ethical ? … welll …
Certainly frowned on when you’re moving billions and avoiding billions in taxes

but not illegal

In the end of the 80s (when I was working At Apple France), the Irish plant builds computers (mostly Macintosh), print manuals, etc. that were sent by truck to Holland, then sent to France (Apple, Les Ulis) and all other European countries (I suppose).

I remember having seen images of the plant, but never go there.

About taxes ? This is a government issue and I cannot do anything for or against.

BTW: I am a bit far away from Locale, sorry.

[quote=470801:@Andy Broughton]Anyway, back to the real problem: “How do I modify my program so it ignores the locale and uses North American standards everywhere”
This is what the customer wants, so no point in having a philosophical discussion about it.[/quote]

Except it is not a philosophical discussion and you’d do it exactly the same as you’d in .Net - accept the input according to the machine settings and convert it to a common locale for internal use.

[quote=470819:@Markus Rauch]i agree it should be possible that the app set the ui language by selection.
[/quote]

It is not the same thing, many Swiss companies have language set to US English, but the locale set to Swiss-German, Swiss-French or Swiss-Italian. It is the same in the German speaking part of Italy and so on.

[quote=470768:@Andy Broughton]How do I set my application to be in a particular Locale, overriding the user’s system default?
This is a single-locale program that needs to not change locales when used in other countries.

Seems like Xojo.Core.Locale.Current is read-only.[/quote]
On windows a “user” can set a specific locale, so let the customer create a specific windows user account that has the locale. As there is no per-application locale setting in windows.
On MacOs you can set the locale per-application.

Edit:
Or learn more here:
https://blog.xojo.com/2014/03/05/picking-a-language-at-runtime/

How?
With .NET, I add one or two lines (see my previous posts), and the program formats everything to the locale I’ve specified. How is that the same in Xojo?

You can read more here:
https://documentation.xojo.com/topics/localizing_your_apps/introduction_to_app_localization.html#Building_the_Localized_App

Some information about Application.Language that uses the “Default” value for language/dynamic constants

Maybe SetThreadUILanguage can help for windows.