Changeset 887
- Timestamp:
- 04/17/08 20:35:26 (8 months ago)
- Files:
-
- branches/1.0.x/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- branches/1.0.x/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- branches/1.0.x/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- branches/1.0.x/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
- branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
- branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
- branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
- trunk/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- trunk/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- trunk/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- trunk/lib/jelix/core/jSelector.class.php (modified) (6 diffs)
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0.x/lib/jelix/core/jSelector.class.php
r835 r887 353 353 */ 354 354 public $subpath =''; 355 /** 355 /** 356 356 * the class name specified in the selector 357 357 * @since 1.0b2 … … 392 392 if (!isset($gJConfig->_modulesPathList[$this->module])) { 393 393 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 394 } 394 } 395 395 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->subpath.$this->className.$this->_suffix; 396 396 … … 413 413 414 414 /** 415 * selector for interface 415 * selector for interface 416 416 * 417 417 * interface is stored in interfacename.iface.php file in the classes/ module directory … … 429 429 430 430 /** 431 * selector for interface 431 * selector for interface 432 432 * @package jelix 433 433 * @subpackage core_selector 434 434 * @since 1.0b2 435 * @deprecated 435 * @deprecated 436 436 */ 437 437 class jSelectorInterface extends jSelectorIface {} … … 470 470 $this->locale = $locale; 471 471 $this->charset = $charset; 472 $this->_dirname = 'locales/' .$locale.'/';473 472 $this->_suffix = '.'.$charset.'.properties'; 474 $this->_cacheSuffix = '.'.$locale.'.'.$charset.'.php';475 473 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 476 474 … … 506 504 } 507 505 508 // on regarde si la locale a été redéfini 509 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 510 if (is_readable ($overloadedPath)){ 511 $this->_path = $overloadedPath; 512 $this->_where = 'overloaded/'; 513 return; 514 } 515 // et sinon, on regarde si la locale existe dans le module en question 516 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 517 518 if (!is_readable ($this->_path)){ 519 // to avoid infinite loop in a specific lang or charset, we should check if we don't 520 // try to retrieve the same message as the one we use for the exception below, 521 // and if it is this message, it means that the error message doesn't exist 522 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 523 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 524 $l = 'en_EN'; 525 $c = 'UTF-8'; 526 } 527 else{ 528 $l = null; 529 $c = null; 530 } 531 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 532 } 533 $this->_where = 'modules/'; 506 $locales = array($this->locale); 507 $lang = substr($this->locale,0,2); 508 $generic_locale = $lang.'_'.strtoupper($lang); 509 if($this->locale !== $generic_locale) 510 $locales[] = $generic_locale; 511 512 foreach($locales as $locale){ 513 // check if the locale has been overloaded 514 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 515 if (is_readable ($overloadedPath)){ 516 $this->_path = $overloadedPath; 517 $this->_where = 'overloaded/'; 518 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 519 return; 520 } 521 // else check for the original locale file 522 $path = $gJConfig->_modulesPathList[$this->module].'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 523 if (is_readable ($path)){ 524 $this->_where = 'modules/'; 525 $this->_path = $path; 526 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 527 return; 528 } 529 } 530 531 // to avoid infinite loop in a specific lang or charset, we should check if we don't 532 // try to retrieve the same message as the one we use for the exception below, 533 // and if it is this message, it means that the error message doesn't exist 534 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 535 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 536 $l = 'en_EN'; 537 $c = 'UTF-8'; 538 } 539 else{ 540 $l = null; 541 $c = null; 542 } 543 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 534 544 } 535 545 branches/1.0.x/lib/jelix/core/jSelector.class.php
r835 r887 353 353 */ 354 354 public $subpath =''; 355 /** 355 /** 356 356 * the class name specified in the selector 357 357 * @since 1.0b2 … … 392 392 if (!isset($gJConfig->_modulesPathList[$this->module])) { 393 393 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 394 } 394 } 395 395 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->subpath.$this->className.$this->_suffix; 396 396 … … 413 413 414 414 /** 415 * selector for interface 415 * selector for interface 416 416 * 417 417 * interface is stored in interfacename.iface.php file in the classes/ module directory … … 429 429 430 430 /** 431 * selector for interface 431 * selector for interface 432 432 * @package jelix 433 433 * @subpackage core_selector 434 434 * @since 1.0b2 435 * @deprecated 435 * @deprecated 436 436 */ 437 437 class jSelectorInterface extends jSelectorIface {} … … 470 470 $this->locale = $locale; 471 471 $this->charset = $charset; 472 $this->_dirname = 'locales/' .$locale.'/';473 472 $this->_suffix = '.'.$charset.'.properties'; 474 $this->_cacheSuffix = '.'.$locale.'.'.$charset.'.php';475 473 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 476 474 … … 506 504 } 507 505 508 // on regarde si la locale a été redéfini 509 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 510 if (is_readable ($overloadedPath)){ 511 $this->_path = $overloadedPath; 512 $this->_where = 'overloaded/'; 513 return; 514 } 515 // et sinon, on regarde si la locale existe dans le module en question 516 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 517 518 if (!is_readable ($this->_path)){ 519 // to avoid infinite loop in a specific lang or charset, we should check if we don't 520 // try to retrieve the same message as the one we use for the exception below, 521 // and if it is this message, it means that the error message doesn't exist 522 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 523 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 524 $l = 'en_EN'; 525 $c = 'UTF-8'; 526 } 527 else{ 528 $l = null; 529 $c = null; 530 } 531 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 532 } 533 $this->_where = 'modules/'; 506 $locales = array($this->locale); 507 $lang = substr($this->locale,0,2); 508 $generic_locale = $lang.'_'.strtoupper($lang); 509 if($this->locale !== $generic_locale) 510 $locales[] = $generic_locale; 511 512 foreach($locales as $locale){ 513 // check if the locale has been overloaded 514 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 515 if (is_readable ($overloadedPath)){ 516 $this->_path = $overloadedPath; 517 $this->_where = 'overloaded/'; 518 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 519 return; 520 } 521 // else check for the original locale file 522 $path = $gJConfig->_modulesPathList[$this->module].'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 523 if (is_readable ($path)){ 524 $this->_where = 'modules/'; 525 $this->_path = $path; 526 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 527 return; 528 } 529 } 530 531 // to avoid infinite loop in a specific lang or charset, we should check if we don't 532 // try to retrieve the same message as the one we use for the exception below, 533 // and if it is this message, it means that the error message doesn't exist 534 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 535 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 536 $l = 'en_EN'; 537 $c = 'UTF-8'; 538 } 539 else{ 540 $l = null; 541 $c = null; 542 } 543 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 534 544 } 535 545 branches/1.0.x/lib/jelix/core/jSelector.class.php
r835 r887 353 353 */ 354 354 public $subpath =''; 355 /** 355 /** 356 356 * the class name specified in the selector 357 357 * @since 1.0b2 … … 392 392 if (!isset($gJConfig->_modulesPathList[$this->module])) { 393 393 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 394 } 394 } 395 395 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->subpath.$this->className.$this->_suffix; 396 396 … … 413 413 414 414 /** 415 * selector for interface 415 * selector for interface 416 416 * 417 417 * interface is stored in interfacename.iface.php file in the classes/ module directory … … 429 429 430 430 /** 431 * selector for interface 431 * selector for interface 432 432 * @package jelix 433 433 * @subpackage core_selector 434 434 * @since 1.0b2 435 * @deprecated 435 * @deprecated 436 436 */ 437 437 class jSelectorInterface extends jSelectorIface {} … … 470 470 $this->locale = $locale; 471 471 $this->charset = $charset; 472 $this->_dirname = 'locales/' .$locale.'/';473 472 $this->_suffix = '.'.$charset.'.properties'; 474 $this->_cacheSuffix = '.'.$locale.'.'.$charset.'.php';475 473 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 476 474 … … 506 504 } 507 505 508 // on regarde si la locale a été redéfini 509 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 510 if (is_readable ($overloadedPath)){ 511 $this->_path = $overloadedPath; 512 $this->_where = 'overloaded/'; 513 return; 514 } 515 // et sinon, on regarde si la locale existe dans le module en question 516 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 517 518 if (!is_readable ($this->_path)){ 519 // to avoid infinite loop in a specific lang or charset, we should check if we don't 520 // try to retrieve the same message as the one we use for the exception below, 521 // and if it is this message, it means that the error message doesn't exist 522 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 523 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 524 $l = 'en_EN'; 525 $c = 'UTF-8'; 526 } 527 else{ 528 $l = null; 529 $c = null; 530 } 531 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 532 } 533 $this->_where = 'modules/'; 506 $locales = array($this->locale); 507 $lang = substr($this->locale,0,2); 508 $generic_locale = $lang.'_'.strtoupper($lang); 509 if($this->locale !== $generic_locale) 510 $locales[] = $generic_locale; 511 512 foreach($locales as $locale){ 513 // check if the locale has been overloaded 514 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 515 if (is_readable ($overloadedPath)){ 516 $this->_path = $overloadedPath; 517 $this->_where = 'overloaded/'; 518 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 519 return; 520 } 521 // else check for the original locale file 522 $path = $gJConfig->_modulesPathList[$this->module].'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 523 if (is_readable ($path)){ 524 $this->_where = 'modules/'; 525 $this->_path = $path; 526 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 527 return; 528 } 529 } 530 531 // to avoid infinite loop in a specific lang or charset, we should check if we don't 532 // try to retrieve the same message as the one we use for the exception below, 533 // and if it is this message, it means that the error message doesn't exist 534 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 535 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 536 $l = 'en_EN'; 537 $c = 'UTF-8'; 538 } 539 else{ 540 $l = null; 541 $c = null; 542 } 543 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 534 544 } 535 545 branches/1.0.x/lib/jelix/core/jSelector.class.php
r835 r887 353 353 */ 354 354 public $subpath =''; 355 /** 355 /** 356 356 * the class name specified in the selector 357 357 * @since 1.0b2 … … 392 392 if (!isset($gJConfig->_modulesPathList[$this->module])) { 393 393 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 394 } 394 } 395 395 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->subpath.$this->className.$this->_suffix; 396 396 … … 413 413 414 414 /** 415 * selector for interface 415 * selector for interface 416 416 * 417 417 * interface is stored in interfacename.iface.php file in the classes/ module directory … … 429 429 430 430 /** 431 * selector for interface 431 * selector for interface 432 432 * @package jelix 433 433 * @subpackage core_selector 434 434 * @since 1.0b2 435 * @deprecated 435 * @deprecated 436 436 */ 437 437 class jSelectorInterface extends jSelectorIface {} … … 470 470 $this->locale = $locale; 471 471 $this->charset = $charset; 472 $this->_dirname = 'locales/' .$locale.'/';473 472 $this->_suffix = '.'.$charset.'.properties'; 474 $this->_cacheSuffix = '.'.$locale.'.'.$charset.'.php';475 473 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 476 474 … … 506 504 } 507 505 508 // on regarde si la locale a été redéfini 509 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 510 if (is_readable ($overloadedPath)){ 511 $this->_path = $overloadedPath; 512 $this->_where = 'overloaded/'; 513 return; 514 } 515 // et sinon, on regarde si la locale existe dans le module en question 516 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 517 518 if (!is_readable ($this->_path)){ 519 // to avoid infinite loop in a specific lang or charset, we should check if we don't 520 // try to retrieve the same message as the one we use for the exception below, 521 // and if it is this message, it means that the error message doesn't exist 522 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 523 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 524 $l = 'en_EN'; 525 $c = 'UTF-8'; 526 } 527 else{ 528 $l = null; 529 $c = null; 530 } 531 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 532 } 533 $this->_where = 'modules/'; 506 $locales = array($this->locale); 507 $lang = substr($this->locale,0,2); 508 $generic_locale = $lang.'_'.strtoupper($lang); 509 if($this->locale !== $generic_locale) 510 $locales[] = $generic_locale; 511 512 foreach($locales as $locale){ 513 // check if the locale has been overloaded 514 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 515 if (is_readable ($overloadedPath)){ 516 $this->_path = $overloadedPath; 517 $this->_where = 'overloaded/'; 518 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 519 return; 520 } 521 // else check for the original locale file 522 $path = $gJConfig->_modulesPathList[$this->module].'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 523 if (is_readable ($path)){ 524 $this->_where = 'modules/'; 525 $this->_path = $path; 526 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 527 return; 528 } 529 } 530 531 // to avoid infinite loop in a specific lang or charset, we should check if we don't 532 // try to retrieve the same message as the one we use for the exception below, 533 // and if it is this message, it means that the error message doesn't exist 534 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 535 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 536 $l = 'en_EN'; 537 $c = 'UTF-8'; 538 } 539 else{ 540 $l = null; 541 $c = null; 542 } 543 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 534 544 } 535 545 branches/1.0.x/lib/jelix/CREDITS
r886 r887 69 69 - fixed bug about infinite loop with non-existent charset (#442) 70 70 - some enhancement in jSession (#445, #504, #506) 71 - localization system should work with language code without country (#95) 71 72 72 73 Bastien Jaillot (aka bastnic) branches/1.0.x/lib/jelix/CREDITS
r886 r887 69 69 - fixed bug about infinite loop with non-existent charset (#442) 70 70 - some enhancement in jSession (#445, #504, #506) 71 - localization system should work with language code without country (#95) 71 72 72 73 Bastien Jaillot (aka bastnic) branches/1.0.x/lib/jelix/CREDITS
r886 r887 69 69 - fixed bug about infinite loop with non-existent charset (#442) 70 70 - some enhancement in jSession (#445, #504, #506) 71 - localization system should work with language code without country (#95) 71 72 72 73 Bastien Jaillot (aka bastnic) branches/1.0.x/lib/jelix/CREDITS
r886 r887 69 69 - fixed bug about infinite loop with non-existent charset (#442) 70 70 - some enhancement in jSession (#445, #504, #506) 71 - localization system should work with language code without country (#95) 71 72 72 73 Bastien Jaillot (aka bastnic) branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php
r851 r887 127 127 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale')); 128 128 // no test2.properties file for fr_CA, so we should have the fr_FR one 129 //$this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA'));129 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA')); 130 130 // no test3.properties file for fr_CA and fr_FR, so we should have the en_EN one 131 131 //$this->assertEqual('this is an en_EN sentence test3',jLocale::get('tests3.first.locale', null, 'fr_CA')); branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php
r851 r887 127 127 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale')); 128 128 // no test2.properties file for fr_CA, so we should have the fr_FR one 129 //$this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA'));129 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA')); 130 130 // no test3.properties file for fr_CA and fr_FR, so we should have the en_EN one 131 131 //$this->assertEqual('this is an en_EN sentence test3',jLocale::get('tests3.first.locale', null, 'fr_CA')); branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php
r851 r887 127 127 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale')); 128 128 // no test2.properties file for fr_CA, so we should have the fr_FR one 129 //$this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA'));129 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA')); 130 130 // no test3.properties file for fr_CA and fr_FR, so we should have the en_EN one 131 131 //$this->assertEqual('this is an en_EN sentence test3',jLocale::get('tests3.first.locale', null, 'fr_CA')); branches/1.0.x/testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php
r851 r887 127 127 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale')); 128 128 // no test2.properties file for fr_CA, so we should have the fr_FR one 129 //$this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA'));129 $this->assertEqual('ceci est une phrase fr_FR test2',jLocale::get('tests2.first.locale', null, 'fr_CA')); 130 130 // no test3.properties file for fr_CA and fr_FR, so we should have the en_EN one 131 131 //$this->assertEqual('this is an en_EN sentence test3',jLocale::get('tests3.first.locale', null, 'fr_CA')); trunk/lib/jelix/core/jSelector.class.php
r834 r887 353 353 */ 354 354 public $subpath =''; 355 /** 355 /** 356 356 * the class name specified in the selector 357 357 * @since 1.0b2 … … 392 392 if (!isset($gJConfig->_modulesPathList[$this->module])) { 393 393 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 394 } 394 } 395 395 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->subpath.$this->className.$this->_suffix; 396 396 … … 413 413 414 414 /** 415 * selector for interface 415 * selector for interface 416 416 * 417 417 * interface is stored in interfacename.iface.php file in the classes/ module directory … … 429 429 430 430 /** 431 * selector for interface 431 * selector for interface 432 432 * @package jelix 433 433 * @subpackage core_selector 434 434 * @since 1.0b2 435 * @deprecated 435 * @deprecated 436 436 */ 437 437 class jSelectorInterface extends jSelectorIface {} … … 470 470 $this->locale = $locale; 471 471 $this->charset = $charset; 472 $this->_dirname = 'locales/' .$locale.'/';473 472 $this->_suffix = '.'.$charset.'.properties'; 474 $this->_cacheSuffix = '.'.$locale.'.'.$charset.'.php';475 473 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 476 474 … … 506 504 } 507 505 508 // on regarde si la locale a été redéfini 509 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 510 if (is_readable ($overloadedPath)){ 511 $this->_path = $overloadedPath; 512 $this->_where = 'overloaded/'; 513 return; 514 } 515 // et sinon, on regarde si la locale existe dans le module en question 516 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 517 518 if (!is_readable ($this->_path)){ 519 // to avoid infinite loop in a specific lang or charset, we should check if we don't 520 // try to retrieve the same message as the one we use for the exception below, 521 // and if it is this message, it means that the error message doesn't exist 522 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 523 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 524 $l = 'en_EN'; 525 $c = 'UTF-8'; 526 } 527 else{ 528 $l = null; 529 $c = null; 530 } 531 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 532 } 533 $this->_where = 'modules/'; 506 $locales = array($this->locale); 507 $lang = substr($this->locale,0,2); 508 $generic_locale = $lang.'_'.strtoupper($lang); 509 if($this->locale !== $generic_locale) 510 $locales[] = $generic_locale; 511 512 foreach($locales as $locale){ 513 // check if the locale has been overloaded 514 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 515 if (is_readable ($overloadedPath)){ 516 $this->_path = $overloadedPath; 517 $this->_where = 'overloaded/'; 518 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 519 return; 520 } 521 // else check for the original locale file 522 $path = $gJConfig->_modulesPathList[$this->module].'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 523 if (is_readable ($path)){ 524 $this->_where = 'modules/'; 525 $this->_path = $path; 526 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 527 return; 528 } 529 } 530 531 // to avoid infinite loop in a specific lang or charset, we should check if we don't 532 // try to retrieve the same message as the one we use for the exception below, 533 // and if it is this message, it means that the error message doesn't exist 534 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 535 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 536 $l = 'en_EN'; 537 $c = 'UTF-8'; 538 } 539 else{ 540 $l = null; 541 $c = null; 542 } 543 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 534 544 } 535 545 trunk/lib/jelix/core/jSelector.class.php
r834 r887 353 353 */ 354 354 public $subpath =''; 355 /** 355 /** 356 356 * the class name specified in the selector 357 357 * @since 1.0b2 … … 392 392 if (!isset($gJConfig->_modulesPathList[$this->module])) { 393 393 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 394 } 394 } 395 395 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->subpath.$this->className.$this->_suffix; 396 396 … … 413 413 414 414 /** 415 * selector for interface 415 * selector for interface 416 416 * 417 417 * interface is stored in interfacename.iface.php file in the classes/ module directory … … 429 429 430 430 /** 431 * selector for interface 431 * selector for interface 432 432 * @package jelix 433 433 * @subpackage core_selector 434 434 * @since 1.0b2 435 * @deprecated 435 * @deprecated 436 436 */ 437 437 class jSelectorInterface extends jSelectorIface {} … … 470 470 $this->locale = $locale; 471 471 $this->charset = $charset; 472 $this->_dirname = 'locales/' .$locale.'/';473 472 $this->_suffix = '.'.$charset.'.properties'; 474 $this->_cacheSuffix = '.'.$locale.'.'.$charset.'.php';475 473 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 476 474 … … 506 504 } 507 505 508 // on regarde si la locale a été redéfini 509 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 510 if (is_readable ($overloadedPath)){ 511 $this->_path = $overloadedPath; 512 $this->_where = 'overloaded/'; 513 return; 514 } 515 // et sinon, on regarde si la locale existe dans le module en question 516 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 517 518 if (!is_readable ($this->_path)){ 519 // to avoid infinite loop in a specific lang or charset, we should check if we don't 520 // try to retrieve the same message as the one we use for the exception below, 521 // and if it is this message, it means that the error message doesn't exist 522 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 523 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 524 $l = 'en_EN'; 525 $c = 'UTF-8'; 526 } 527 else{ 528 $l = null; 529 $c = null; 530 } 531 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 532 } 533 $this->_where = 'modules/'; 506 $locales = array($this->locale); 507 $lang = substr($this->locale,0,2); 508 $generic_locale = $lang.'_'.strtoupper($lang); 509 if($this->locale !== $generic_locale) 510 $locales[] = $generic_locale; 511 512 foreach($locales as $locale){ 513 // check if the locale has been overloaded 514 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 515 if (is_readable ($overloadedPath)){ 516 $this->_path = $overloadedPath; 517 $this->_where = 'overloaded/'; 518 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 519 return; 520 } 521 // else check for the original locale file 522 $path = $gJConfig->_modulesPathList[$this->module].'/locales/'.$locale.'/'.$this->resource.$this->_suffix; 523 if (is_readable ($path)){ 524 $this->_where = 'modules/'; 525 $this->_path = $path; 526 $this->_cacheSuffix = '.'.$locale.'.'.$this->charset.'.php'; 527 return; 528 } 529 } 530 531 // to avoid infinite loop in a specific lang or charset, we should check if we don't 532 // try to retrieve the same message as the one we use for the exception below, 533 // and if it is this message, it means that the error message doesn't exist 534 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 535 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 536 $l = 'en_EN'; 537 $c = 'UTF-8'; 538 } 539 else{ 540 $l = null; 541 $c = null; 542 } 543 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 534 544 } 535 545 trunk/lib/jelix/core/jSelector.class.php
r834 r887 353 353 */ 354 354 public $subpath =''; 355 /** 355 /** 356 356 * the class name specified in the selector 357 357 * @since 1.0b2 … … 392 392 if (!isset($gJConfig->_modulesPathList[$this->module])) { 393 393 throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString()); 394 } 394 } 395 395 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->subpath.$this->className.$this->_suffix; 396 396 … … 413 413 414 414 /** 415 * selector for interface 415 * selector for interface 416 416 * 417 417 * interface is stored in interfacename.iface.php file in the classes/ module directory … … 429 429 430 430 /** 431 * selector for interface 431 * selector for interface 432 432 * @package jelix 433 433 * @subpackage core_selector 434 434 * @since 1.0b2 435 * @deprecated 435 * @deprecated 436 436 */ 437 437 class jSelectorInterface extends jSelectorIface {} … … 470 470 $this->locale = $locale; 471 471 $this->charset = $charset; 472 $this->_dirname = 'locales/' .$locale.'/';473 472 $this->_suffix = '.'.$charset.'.properties'; 474 $this->_cacheSuffix = '.'.$locale.'.'.$charset.'.php';475 473 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 476 474 … … 506 504 } 507 505 508 // on regarde si la locale a été redéfini 509 $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix; 510 if (is_readable ($overloadedPath)){ 511 $this->_path = $overloadedPath; 512 $this->_where = 'overloaded/'; 513 return; 514 } 515 // et sinon, on regarde si la locale existe dans le module en question 516 $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix; 517 518 if (!is_readable ($this->_path)){ 519 // to avoid infinite loop in a specific lang or charset, we should check if we don't 520 // try to retrieve the same message as the one we use for the exception below, 521 // and if it is this message, it means that the error message doesn't exist 522 // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset 523 if($this->toString() == 'jelix~errors.selector.invalid.target'){ 524 $l = 'en_EN'; 525 $c = 'UTF-8'; 526 } 527 else{ 528 $l = null; 529 $c = null; 530 } 531 throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c); 532 } 533 $this->_where = 'modules/'; 506 &nb
