Welcome Guest, Not a member yet? Register   Sign In
i18n and ajax page not showing translated lang
#1

[eluser]kamikaz[/eluser]
Hi,

I'm developing a multilang website with http://jeromejaglale.com/doc/php/codeigniter_i18n.
Everything works great on the main page (as for now I only have one page Wink) but when I load a page through ajax (like a form page), the text doesn't appear: the 'lang' method doesn't find the translation.

My url looks like mysite.tld/en/modules/login/dsplogin. 'modules' is a folder in controllers folder, etc.

When I access the page directly, it is the same: text is not translated.

In ajax, I tried to call '/en/modules/login/dsplogin' and '/modules/login/dsplogin' but it didn't solve the issue.

I don't have a clue about the problem Smile Do you?

I think it is related to the url: maybe it doesn't like controllers in a sub-folder Smile

Regards
#2

[eluser]kamikaz[/eluser]
Nobody has a solution? I'm still searching on the web but nobody seems to have this problem.

I put my htaccess and my routes, maybe it is a start:

Code:
RewriteEngine on

# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index\.php|assets|css|js|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^(en|de|fr|nl|it|es)/assets/(.*)$ /assets/$1 [L]
RewriteRule ^(en|de|fr|nl|it|es)/(.*)$ $1 [L]

Code:
$route['default_controller'] = 'main';
$route['404_override'] = '';
$route['translate_uri_dashes'] = TRUE;
//LANG ROUTES
$route['^(en|de|fr|nl|it|es)/assets/(.+)$'] = "assets/$2";
// URI like '/en/about' -> use controller 'about'
$route['^(en|de|fr|nl|it|es)/(.+)$'] = "$2";
// '/en', '/de', '/fr' and '/nl' URIs -> use default controller
$route['^(en|de|fr|nl|it|es)$'] = $route['default_controller'];
#3

[eluser]InsiteFX[/eluser]
The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches,
no further rules will be processed. This corresponds to the last command in Perl, or the break command in C. Use this
flag to indicate that the current rule should be applied immediately without considering further rules.
#4

[eluser]kamikaz[/eluser]
Thank you for your reply InsiteFX but I must admit that I don't understand you...

I user the [L] flag in my htaccess. I just figured out that I have two same RewriteRule ^(.*)$ /index.php/$1 [L].




Theme © iAndrew 2016 - Forum software by © MyBB