developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 13 years ago

Closed 13 years ago

#358 closed enhancement (fixed)

possibilité de surcharger les locales

Reported by: rahal Owned by: laurentj
Priority: normal Milestone: Jelix 1.0 RC1
Component: jelix:core Version: 1.0 beta 3.1
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed:
Hosting Provider: Php version:

Description

en examinant le code, je dirai que seuls les daos peuvent etre surchargés.

Change History (5)

comment:1 Changed 13 years ago by laurentj

  • Summary changed from surcharge locales dans overloads ne fonctionne pas to possibilité de surcharger les locales
  • Type changed from bug to enhancement

comment:2 Changed 13 years ago by rahal

l'ajout des deux methodes dans jSelectorLoc permet cette surcharge ( un petit refactoring peut etre envisagé )

    protected function _createPath(){
        global $gJConfig;
        if(!isset($gJConfig->_modulesPathList[$this->module])){
            throw new jExceptionSelector('jelix~errors.selector.module.unknow', $this->toString());
        }

        // on regarde si la locale a été redéfini
        $overloadedPath = JELIX_APP_VAR_PATH.'overloads/'.$this->module.'/'.$this->_dirname.$this->resource.$this->_suffix;
        if (is_readable ($overloadedPath)){
           $this->_path = $overloadedPath;
           $this->_where = 1;
           return;
        }
        // et sinon, on regarde si la locale existe dans le module en question
        $this->_path = $gJConfig->_modulesPathList[$this->module].$this->_dirname.$this->resource.$this->_suffix;

        if (!is_readable ($this->_path)){
            throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "locale"));
        }
        $this->_where = 0;
    }

    protected function _createCachePath(){
        $d = array('modules/','overloaded/');
        // on ne partage pas le même cache pour tous les emplacements possibles
        // au cas où un overload était supprimé
        $this->_cachePath = JELIX_APP_TEMP_PATH.'compiled/locales/'.$d[$this->_where].$this->module.'~'.$this->resource.$this->_cacheSuffix;
    } 

comment:3 Changed 13 years ago by laurentj

  • Milestone set to Jelix 1.0 RC1

comment:4 Changed 13 years ago by laurentj

  • Component changed from jelix to jelix:core
  • Owner set to laurentj

comment:5 Changed 13 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed

Patch inclus dans le trunk. Merci pour le patch :-)

Note: See TracTickets for help on using tickets.