FoxInCloud
How to internationalize my applications ?
Gravatar is a globally recognized avatar based on your email address. How to internationalize my applications ?
  Gilles Lajot-Sarthou
  All
  Apr 8, 2021 @ 02:01am

Hi Thierry

How to recognize the language of the country of the client browser so that FoxInCloud indicates in the Form.wcLangUser property the language code of the client browser ?

I am looking to internationalize messages, texts, captions etc. depending on the client browser or depending on a user choice of language in my application.

Does the abdev.cLangUser () function seem to me to return the language of the machine running the application?

Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: How to internationalize my applications ?
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Apr 8, 2021 @ 04:57am

Hi Gilles,

FoxInCloud sets xxxFrm.wcLangUser to:

  • desktop mode: the OS language
  • web mode: the browser language

You can see that implemented in the FoxInCloud Live Tutorial with this label class:

&& modify class ficLbl of (home(1) + "tools\ab\aw\samples\FIC\classe\ficSample")

DEFINE CLASS ficlbl AS awlbl

  caption_en = "" && properties added at design time to host the localized captions
  caption_fr = "" && you can also get the localized captions dynamically from a table
  caption_es = ""
  caption_de = ""
  caption_it = ""
  caption_pt = ""
  wcpropsave = "Caption"
  wcpropsavenot = "Caption_de, Caption_en, Caption_fr, Caption_es, Caption_it, Caption_pt"
  …

  PROCEDURE refresh_
    lparameters void_parameter_reminder_call_dodefault_in_your_sub_class_code

    if Type('thisForm.wcLangUser') == 'C' and !empty(thisForm.wcLangUser)

      local lcCaptionEN
      lcCaptionEN = Evl(this.Caption_EN, this.Caption)
      this.Caption = Iif(lProperty(m.this, 'Caption_' + thisForm.wcLangUser); && supported language?
        , Evl(Evaluate('m.this.Caption_' + thisForm.wcLangUser), m.lcCaptionEN); && English if localized caption empty
        , m.lcCaptionEN; && default: English
        )

    endif
  ENDPROC
…
ENDDEFINE

You can also take a look at:
modify form (home(1) + "tools\ab\aw\samples\fic\fictuto\progs\forms\index.scx") method cboMore.Refresh_

Gravatar is a globally recognized avatar based on your email address. re: How to internationalize my applications ?
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Apr 8, 2021 @ 06:36am

Merci Thierry,

Thanks to the explanations and the TutoTest, I had already understood how to use the Form.wcLangUser property.

My question was to understand when and how she was affected by FoxInCloud.

You partially answered my question by telling me that FoxInCloud differentiated its value in WEB mode and in Desktop mode. In WEB, the language of the internet browser will be indicated in wcLangUser, that's good!

Would it be possible:

  • to force a language from a combobox, a language different from the native one of the browser, and for my entire application to switch to this language for the duration of the connected session?
  • change the language as soon as the user logs in (language taken from a table containing the user's data)?

Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: How to internationalize my applications ?
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Apr 8, 2021 @ 11:11am

Gilles,

You can override xxxFrm.wcLangUser in xxxFrm.wUserAction_ante()

Gravatar is a globally recognized avatar based on your email address. re: How to internationalize my applications ?
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Apr 9, 2021 @ 03:28am

Merci Thierry,

I try it next week..

Amicalement Gilles

© 1996-2021