Jump to content

Get file language


Recommended Posts

I need to get the language from a file. My files are named bla_e.php and bla_f.php. How can I identify the language in javascript?

Link to post
Share on other sites

only if you have 1 line followinglike

if(condition) dosomething();//orif(condition)  dosomething();//unexpected resultif(condition)  doSomething();  do somethingElse();//what the above is really doingif(condition){  dosomething();}dosomethingElse();

Link to post
Share on other sites
var url = window.location;var lang = "";if(url.indexOf("_e.php") != -1)  lang = "english";else if(url.indexOf("_f.php") != -1) lang = "french";else  lang = "unknown";

I tried your code but I get javascript errors. It says that url.indexOf is not a function. Then I tried url.search and it said the same thing...
Link to post
Share on other sites
I tried your code but I get javascript errors. It says that url.indexOf is not a function. Then I tried url.search and it said the same thing...
hi,first try to assign the var url the value window.location.href(var url = window.location.href) then try the codew again.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...