php - Gettext gives lot of errors (page completely broken) -


i want internationalize website, have download gettext librairie (i work on localhost , have disable gettext module).

i followed tutorial translation works :

but website broken when use /?lang=en_us.

google chrome errors :

resource interpreted stylesheet transferred mime type text/html: "http://localhost/mysite/index.php/assets/bootstrap/css/bootstrap.min.css". localhost/:11 resource interpreted stylesheet transferred mime type text/html: "http://localhost/mysite/index.php/assets/fonts/font-awesome/css/font-awesome.min.css". localhost/:12 resource interpreted stylesheet transferred mime type text/html: "http://localhost/mysite/index.php/assets/stylesheets/custom.css". ?lang=en_us:13 resource interpreted stylesheet transferred mime type text/html: "http://localhost/mysite/index.php/assets/stylesheets/media-queries.css". jquery-1.11.3.min.js:2 uncaught syntaxerror: unexpected token < bootstrap.min.js:2 uncaught syntaxerror: unexpected token < ?lang=en_us:97 uncaught referenceerror: $ not defined     @ ?lang=en_us:97 (anonymous) @ ?lang=en_us:97 ?lang=en_us:142 uncaught referenceerror: $ not defined     @ ?lang=en_us:142 (anonymous) @ ?lang=en_us:142 ?lang=en_us:138 resource interpreted stylesheet transferred mime type text/html: "http://localhost/mysite/index.php/assets/stylesheets/datatables.bootstrap.min.css". jquery.datatables.min.js:2 uncaught syntaxerror: unexpected token < datatables.bootstrap.min.js:2 uncaught syntaxerror: unexpected token < datatables.datesorting.js:2 uncaught syntaxerror: unexpected token < 

this localization file :

<?php  error_reporting(e_all | e_strict);  // define constants define('project_dir', realpath('./')); define('locale_dir', project_dir .'/locale'); define('default_locale', 'fr_fr');  require_once('./librairies/gettext/gettext.inc');  $supported_locales = array('en_us', 'fr_fr'); $encoding = 'utf-8';  $locale = (isset($_get['lang']))? $_get['lang'] : default_locale;  // gettext setup t_setlocale(lc_messages, $locale); // set text domain 'messages' $domain = 'traduction'; bindtextdomain($domain, locale_dir); // bind_textdomain_codeset supported in php 4.2.0+ if (function_exists('bind_textdomain_codeset'))    bind_textdomain_codeset($domain, $encoding); textdomain($domain);  header("content-type: text/html; charset=$encoding"); ?> 

and here part of index file :

<?php require_once __dir__.'/localization.php'; ?>  <!doctype html> <html lang="fr" class="no-js">   <head>     <meta charset="utf-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <meta name="description" content="">     <title><?php echo $title; ?> - mysite</title>      <link rel="stylesheet" href="./assets/bootstrap/css/bootstrap.min.css">     ....     <script src="./assets/javascripts/bootstrap/bootstrap.min.js"></script>   </head>    <body> <h1><?php echo _("bienvenue !"); ?></h1> <h1><?php echo _("maison"); ?></h1> 

can me resolve ?

thank you

your link css have error. think name of page index.php cause error:

http://localhost/mysite/index.php/assets/stylesheets/datatables.bootstrap.min.css 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -