How to run my application from web using some parameters?

0 favourites
  • 6 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Hi for all!

    The question is about:

    I have a personal wiki-site. I have an application stored on that site. This app supplies 2 different languages (also like a site).

    How can I run my application with parameter (or any another way) that will have an information about page language? If I will run app from english page, it must be in english, if I'll run it from russian page, it must be in russian.

    For now I can make it just with WebStorage. But it saves data user must to input by himself when he will start this app for the first time (if an english-speaking user will run it first time he'll see default-russian text first, then he have to switch into english mode, just after that language option will be saved for the next time).

    I want user to avoid switching. If he will start app from english page - he must take an english version of program.

    How to make this? How to run application with some language parameter?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Maybe you could use the browser plugin and check the url. Then set the application to run based on that information.

  • I think it will not work because in this way I should know url of previous page, because current page will be application url.. It will be no so good to make 2 identical folders (for example "ru" and "en") to read this information and switch according to it..

  • Well you could use Browser.Referrer then which will tell you the url of the refering page.

  • Hi for all!

    The question is about:

    I have a personal wiki-site. I have an application stored on that site. This app supplies 2 different languages (also like a site).

    How can I run my application with parameter (or any another way) that will have an information about page language? If I will run app from english page, it must be in english, if I'll run it from russian page, it must be in russian.

    For now I can make it just with WebStorage. But it saves data user must to input by himself when he will start this app for the first time (if an english-speaking user will run it first time he'll see default-russian text first, then he have to switch into english mode, just after that language option will be saved for the next time).

    I want user to avoid switching. If he will start app from english page - he must take an english version of program.

    How to make this? How to run application with some language parameter?

    You can do it with php... how the language is detected? just add one variable $language=

    I suggest you to use php, when you have your variable in php, just set:

    $_SESSION['language'] = $languageinwebsite;

    after this, just make a new page php who call the echo of the "echo $_SESSION['language'];"

    in construct2, make a call AJAX of the page where you put the echo SESSION

  • Thanks for all your answers! This is my solution:

    1. It seems, there is no problem to execute game URL like this: .../index.html?lang=en

    2.

    System -> On start of layout
       Set value (VAR) to Browser.QueryParam("lang");[/code:126s9wj7]
    3. Result is VAR = "en"
    4. Now I can make all I want with VAR in my program!
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)