Jump to content

Get file language


vchris
 Share

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 comment
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 comment
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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...