Forcing a Locale

  1. ‹ Older
  2. 2 weeks ago

    Norman P

    Jan 9 Pre-Release Testers, Xojo Pro outside

    @Markus R i don't know but the docu wrote:
    This Application property can only be set in the Inspector and is not available in code.
    The Region Code of the application, corresponding to the version information.
    Not supported on Windows. This property can be set only in the IDE.
    docs.xojo.com/Application.RegionCode

    And I cannot find a setting in any inspector field for it

  3. Norman P

    Jan 9 Pre-Release Testers, Xojo Pro outside

    @Markus R what is the meaning of build settings at shared build language?
    i remember i had test my app in english and german but now/today it did not change the ui language at runtime.

    The language is NOT a locale - just a language
    Basically its the language the app was built in and it the very last fallback to use when trying to look up localized strings
    Say you have an app with localized strings in French, German, and Italian
    But you built it using English as the default
    Then any default values in localized strings are "English" (regarldess of what you actually put in there)
    see https://blog.xojo.com/2013/12/17/how-os-x-chooses-a-language/

  4. Andy B

    Jan 9 Airdrie, AB, Canada

    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.

  5. Anthony C

    Jan 9 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store, Forum Moderators, MVP GraffitiSuite Developer
    Edited 2 weeks ago

    @Andy B 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.

    That is how it should be. From the Str Docs:

    Returns the string form of the value passed. When dealing with numbers you can optionally format the number using US/English notation. Use the related Val function to convert strings to numbers. Use the Format function to format the number using the system settings for numerical display.

  6. Gavin S

    Jan 9 Pre-Release Testers, Xojo Pro, Forum Moderators, MVP UK

    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.

    -image-

  7. Andy B

    Jan 9 Airdrie, AB, Canada

    @Anthony C That is how it should be. From the Str Docs:

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

  8. Andy B

    Jan 9 Airdrie, AB, Canada

    @Gavin S Here's a much better way of dealing with this issue, assuming your client is on a Mac.

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

  9. Gavin S

    Jan 9 Pre-Release Testers, Xojo Pro, Forum Moderators, MVP UK
    Edited 2 weeks ago

    @Andy B I have more European Windows users than Mac.

    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

    @Andy B I always figured Apple is more a NA phenomenon, but I haven't really researched it...

    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.

  10. Emile S

    Jan 9 Europe (France, Strasbourg)

    @Gavin S a NA company

    What is a NA company, please ?

  11. Norman P

    Jan 9 Pre-Release Testers, Xojo Pro outside

    north american I assume from the context

  12. Andy B

    Jan 9 Airdrie, AB, Canada

    @Norman P north american I assume from the context

    Oui.

  13. Emile S

    Jan 9 Europe (France, Strasbourg)

    @Norman P north american I assume from the context

    Thanks.

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

  14. Norman P

    Jan 9 Pre-Release Testers, Xojo Pro outside

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

    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

  15. Emile S

    Jan 9 Europe (France, Strasbourg)

    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.

  16. James D

    Jan 9 Pre-Release Testers, Xojo Pro Europe (Switzerland)

    @Andy B 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.

    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.

  17. James D

    Jan 9 Pre-Release Testers, Xojo Pro Europe (Switzerland)

    @Markus R i agree it should be possible that the app set the ui language by selection.

    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.

  18. Derk J

    Jan 9 Pre-Release Testers, Xojo Pro
    Edited 2 weeks ago

    @Andy B 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.

    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/

  19. Andy B

    Jan 11 Airdrie, AB, Canada

    @James D 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.

    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?

  20. Derk J

    Jan 12 Pre-Release Testers, Xojo Pro

    You can read more here:
    https://docs.xojo.com/UserGuide:Localization#Building_the_Localized_App

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

  21. Julian S

    Jan 12 Pre-Release Testers, Xojo Pro UK

    Maybe SetThreadUILanguage can help for windows.

or Sign Up to reply!