<commit_before><?php
// +----------------------------------------------------------------------+
// | popoon                                                               |
// +----------------------------------------------------------------------+
// | Copyright (c) 2001,2002,2003,2004 Bitflux GmbH                       |
// +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the 'License');      |
// | you may not use this file except in compliance with the License.     |
// | You may obtain a copy of the License at                              |
// | http://www.apache.org/licenses/LICENSE-2.0                           |
// | Unless required by applicable law or agreed to in writing, software  |
// | distributed under the License is distributed on an 'AS IS' BASIS,    |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      |
// | implied. See the License for the specific language governing         |
// | permissions and limitations under the License.                       |
// +----------------------------------------------------------------------+
// | Author: <NAME> <<EMAIL>>                        |
// +----------------------------------------------------------------------+
//
// $Id$

/**
* This is a driver for the i18n tranformer
*
* This driver reads from an xml file. It uses the same format as the 
*   one in cocoon. See
*   http://cocoon.apache.org/2.1/userdocs/transformers/i18n-transformer.html#Catalogues+%28Dictionaries%29
*   for some details.
*
* Here's a simple catalog (put it into xml/catalog_de.xml and add src="xml/catalog" to the pipeline as 
*  attribute of <xsl:transform>):
* <?xml version="1.0"?>
* <catalogue xml:lang="de">
*    <message key="Latest Blog Posts">Neuste Blog Posts</message>
* </catalogue>
*
* @author   <NAME> <<EMAIL>>
* @version  $Id$
* @package  popoon
*/


class popoon_components_transformers_i18n_xml {

    protected $catctx = NULL;
    
    function __construct($src,$lang) {
        if (!$cat = @domdocument::load($src.'_'.$lang.'.xml')) {
            $lang = substr($lang,0,-(strrpos($lang,"_")+1));
            $cat = @domdocument::load($src.'_'.$lang.'.xml');
        }

        if($cat instanceof DOMDocument) {
            // resolve xincludes
            $cat->xinclude();<commit_msg>try without language, if not found<commit_after><?php
// +----------------------------------------------------------------------+
// | popoon                                                               |
// +----------------------------------------------------------------------+
// | Copyright (c) 2001,2002,2003,2004 Bitflux GmbH                       |
// +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the 'License');      |
// | you may not use this file except in compliance with the License.     |
// | You may obtain a copy of the License at                              |
// | http://www.apache.org/licenses/LICENSE-2.0                           |
// | Unless required by applicable law or agreed to in writing, software  |
// | distributed under the License is distributed on an 'AS IS' BASIS,    |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      |
// | implied. See the License for the specific language governing         |
// | permissions and limitations under the License.                       |
// +----------------------------------------------------------------------+
// | Author: <NAME> <<EMAIL>>                        |
// +----------------------------------------------------------------------+
//
// $Id$

/**
* This is a driver for the i18n tranformer
*
* This driver reads from an xml file. It uses the same format as the 
*   one in cocoon. See
*   http://cocoon.apache.org/2.1/userdocs/transformers/i18n-transformer.html#Catalogues+%28Dictionaries%29
*   for some details.
*
* Here's a simple catalog (put it into xml/catalog_de.xml and add src="xml/catalog" to the pipeline as 
*  attribute of <xsl:transform>):
* <?xml version="1.0"?>
* <catalogue xml:lang="de">
*    <message key="Latest Blog Posts">Neuste Blog Posts</message>
* </catalogue>
*
* @author   <NAME> <<EMAIL>>
* @version  $Id$
* @package  popoon
*/


class popoon_components_transformers_i18n_xml {

    protected $catctx = NULL;
    
    function __construct($src,$lang) {
        if (!$cat = @domdocument::load($src.'_'.$lang.'.xml')) {
            $lang = substr($lang,0,-(strrpos($lang,"_")+1));
            if (!$cat = @domdocument::load($src.'_'.$lang.'.xml')) {
            	 $cat = @domdocument::load($src.'.xml');
	    }
        }
        if($cat instanceof DOMDocument) {
            // resolve xincludes
            $cat->xinclude();
{'fraction_non_alphanumeric': 0.2681099084096586, 'fraction_numerical': 0.01498751040799334, 'mean_word_length': 1.3623402163225171, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 2, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 19}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5145097', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1195, 'n_words': 357}