• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cookies, cache

Contributor ,
Mar 29, 2021 Mar 29, 2021

Copy link to clipboard

Copied

Bonjour,
Sur mon site, j'essaye de mettre en place une version multi-langues à base de sessions (<set session.lg="en">).
Or, lors du changement de pays, le cache intervient (je pense) et aucun changement ne se produit.
Je ne sais que faire 😞
Qu'en est-il du cache, des cookies ?
Merci par avance
Qu'en est-il du cache ?
Merci par avance

 

Hello,
On my site, I'm trying to set up a multi-language session-based version (<set session.lg = "en">).
However, when changing country, the cache intervenes (I think) and no change occurs.
I do not know what to do 😞
What about the cache, cookies?
thanks in advance

Views

236

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Apr 03, 2021 Apr 03, 2021

Thanks for your explanation. It is clear what you want to achieve.

 

Given your requirements, here are some suggestions:

 

@ZNB : ... a multi-language session-based version (<set session.lg = "en">)....The user has the possibility to choose his language when entering the site by clicking on a flag which toggles the session.lg according to the language.

 

A custom session variable, such as session.lg, is stored in memory. That is, on the server. Hence, not as a cookie on the client. Therefore, if

...

Votes

Translate

Translate
Contributor , Apr 03, 2021 Apr 03, 2021

Bonjour,

Merci pour votre retour.

C'est exactement ce que je voulais.

Cordialement

 

Hello,

Thanks for your feedback.

That's exactly what I wanted.

cordially

 

Votes

Translate

Translate
Contributor ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

HELP

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

Let me understand your requirements. They are:

  • multi-language: two or more versions of the same application, each in a different language;
  • session-based: you wish to use sessions (session.lg = "en", session.lg = "fr") to decide the version that will serve a particular user.

Is that so? If so, please explain how you achieve this.

 

How do you change the country? How do you relate this to session.lg?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 02, 2021 Apr 02, 2021

Copy link to clipboard

Copied

Bonjour

Il n’y a qu’une seule version.

Tous les mots, phrases ou textes à traduire en base de données avec à chaque fois, une traduction suivant la langue.

L’utilisateur a la possibilité de choisir sa langue à l’entrée sur le site en cliquant sur un drapeau qui fait basculer la session.lg suivant la langue.

Malheureusement, cette dernière changée, cela n’a pas d’effet à moins de vider manuellement les cookies et le cache. Comment le faire automatiquement ?

Hello

There is only one version.

All the words, sentences or texts to be translated in a database with each time a translation according to the language.

The user has the possibility to choose his language when entering the site by clicking on a flag which toggles the session.lg according to the language.

Unfortunately, the latter changed, this has no effect unless you manually clear the cookies and cache. How to do it automatically?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 03, 2021 Apr 03, 2021

Copy link to clipboard

Copied

Thanks for your explanation. It is clear what you want to achieve.

 

Given your requirements, here are some suggestions:

 

@ZNB : ... a multi-language session-based version (<set session.lg = "en">)....The user has the possibility to choose his language when entering the site by clicking on a flag which toggles the session.lg according to the language.

 

A custom session variable, such as session.lg, is stored in memory. That is, on the server. Hence, not as a cookie on the client. Therefore, if there is no change when the user clicks on the flag, it will mean that the application failed to update the value of session.lg.

 

One hypothesis is that, during the switch from one user to the next, the session stayed the same. By manually clearing the cookies you then forced ColdFusion to start a new session. I am assuming that you want a new session to start whenever a user clicks on a language flag.

 

Should this hypothesis be correct, I would implement the language requirement as follows:

 

1.  Implement the login code right after you validate a successful user-login:

 

<cflogin>
<cfloginuser name = "bkbk" password = "bkbk-pw" roles = "user">
</cflogin>

 

 

2.  Configure the application to store the user's login information in the session scope:

 

<!--- in Application.cfc --->
<cfset this.name = "AppName">
<cfset this.sessionManagement = true>
<cfset this.sessionTimeout = createTimeSpan(0,0,20,0)>
<cfset this.loginStorage="session">

 

 

3.  Implement the logout code right after you log the user out:

 

<cflogout>

 

 

4.  When a user clicks on the language flag:

 

<!--- Include code to log the user out --->
<!--- Code to invalidate the session --->
<cfset sessionInvalidate()>
<!--- Code to reset the language --->
<cfset session.lg="fr">
<!--- Include code to log the user in --->

 

 

5.  When a user clicks on the country flag:

 

<!--- Include code to log the user out --->
<!--- Code to invalidate the session --->
<cfset sessionInvalidate()>
<!--- Code (query) to get the language, based on the country. For example, "fr" for France or Senegal  --->
...
<!--- Code to reset the language --->
<cfset session.lg="fr">
<!--- Include code to log the user in --->

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 03, 2021 Apr 03, 2021

Copy link to clipboard

Copied

LATEST

Bonjour,

Merci pour votre retour.

C'est exactement ce que je voulais.

Cordialement

 

Hello,

Thanks for your feedback.

That's exactly what I wanted.

cordially

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation