duanjingyu007 / jquery-i18n-properties

Automatically exported from code.google.com/p/jquery-i18n-properties
0 stars 0 forks source link

Erro 404 while trying to get messages_en from server #25

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. try change the language to EN like the exemple at this page: 
http://codingwithcoffee.com/files/trunk/index.html 

What is the expected output? What do you see instead?
should not show the error message on firebug's console.

What version of the product are you using? On what operating system?
1.09

Please provide any additional information below.

Original issue reported on code.google.com by vinyoliv...@gmail.com on 19 Mar 2013 at 12:54

GoogleCodeExporter commented 8 years ago
I implemented this jquery plugin but are not exactly sure about the intent of 
the code block below.
In my case, I don't specify a language. So the first call successfully loads 
and parse my properties file. Then the code tries to load _en.properties and I 
get a 404 and then continues to try and load _en-US.properties and I get a 404. 
It does this because a few lines above the browser supplied the language as 
en-US. This is annoying since my server logs get filled up with 404's and the 
javascript console display these errors too.

I would like the plugin to quit loading after it successfully loads my 
properties file.

Maybe an addition of a setting to tell the plugin to not use the browser 
language will solve this problem. Then the language length will be smaller than 
2 hence the 2 last if statements won't execute.

for(i=0; i<files.length; i++) {
    // 1. load base (eg, Messages.properties)
    loadAndParseFile(settings.path + files[i] + '.properties', settings);
        // 2. with language code (eg, Messages_pt.properties)
    if(settings.language.length >= 2) {
            loadAndParseFile(settings.path + files[i] + '_' + settings.language.substring(0, 2) +'.properties',settings);
    }
    // 3. with language code and country code (eg, Messages_pt_PT.properties)
        if(settings.language.length >= 5) {
            loadAndParseFile(settings.path + files[i] + '_' + settings.language.substring(0, 5) +'.properties',settings);
        }
}

Original comment by Lind...@gmail.com on 23 Oct 2013 at 6:52

GoogleCodeExporter commented 8 years ago
Can u please explain how to use this For loop for selecting a particular locale 
since same error also comes for me.

Original comment by rishic1...@gmail.com on 3 Apr 2014 at 6:34