| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Languages 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 class editView extends View 19 { 20 function render(&$renderer, &$request) 21 { 22 $task = $request->get('task'); 23 $act = $request->get('act'); 24 25 foreach ($request->get() as $key => $value) $renderer->addvar($key, $value); 26 switch ($act) 27 { 28 case 'language': 29 if ($task == 'new')$this->newlanguage($renderer, $request); 30 else $this->editlanguage($renderer, $request); 31 break; 32 33 case 'catalogs': 34 default: 35 $this->editcatalog($renderer, $request); 36 break; 37 } 38 $renderer->display('form.tpl.php'); 39 } 40 41 42 function newlanguage(&$renderer, &$request) { 43 $locales = getlocales(); 44 $header = T_('Language').' : <small>'.T_('New language').'</small>'; 45 $renderer->addvar('header', $header); 46 $renderer->addvar('locales', $locales['locales']); 47 $renderer->addvar('territories', $locales['territories'] ); 48 $renderer->addvar('codesets', $locales['codesets']); 49 $renderer->addvar('dateformats', $locales['dateformats']); 50 $renderer->addvar('directions', $locales['directions']); 51 $renderer->addvar('plural_forms', $locales['plural_forms']); 52 $renderer->addvar('content', $renderer->fetch('langform.tpl.php')); 53 } 54 55 function editlanguage(&$renderer, &$request) { 56 57 $lang = mosGetParam($_REQUEST,'lang'); 58 $language =& new mamboLanguage($lang); 59 $header = T_('Language').' : <small>'.T_('Edit language') . " [ {$language->title} ] ".'</small>'; 60 $renderer->addvar('header', $header); 61 $renderer->addvar('language', $language); 62 $renderer->addvar('plurals', $this->plurals()); 63 $renderer->addvar('content', $renderer->fetch('langform.tpl.php')); 64 } 65 66 function editcatalog(&$renderer, &$request) { 67 $lang = $request->get('lang'); 68 $language = new mamboLanguage($lang); 69 $domain = $request->get('domain'); 70 $catalog = new PHPGettext_catalog($domain, mamboCore::get('rootPath')."/language"); 71 $catalog->setproperty('mode', _MODE_PO_); 72 $catalog->setproperty('lang', $lang); 73 $catalog->load(); 74 $nplurals = 2; 75 $_VERSION = new version(); 76 77 78 if (strpos($catalog->headers['Last-Translator'], 'FULL NAME')) { 79 $catalog->headers['Last-Translator'] = "Translation <translation@mambo-foundation.org>"; 80 } 81 if (strpos($catalog->headers['Language-Team'], 'LANGUAGE')) { 82 $catalog->headers['Language-Team'] = "Translation <translation@mambo-foundation.org>"; 83 } 84 $catalog->headers['Project-Id-Version'] = $_VERSION->PRODUCT.' '.$_VERSION->RELEASE; 85 $catalog->headers['Report-Msgid-Bugs-To'] = 'translation@mambo-foundation.org'; 86 $catalog->headers['Plural-Forms'] = $language->plural_form['expression']; 87 $catalog->headers['Content-Type'] = 'text/plain; charset='.$language->charset; 88 $renderer->addvar('header', sprintf(T_('Translate Catalog: %s [%s]'),$domain, $lang)); 89 $renderer->addvar('nplurals', $language->plural_form['nplurals']); 90 $renderer->addbyref('catalog', $catalog); 91 $renderer->addvar('domain', $domain); 92 $renderer->addvar('content', $renderer->fetch('editcatalog.tpl.php')); 93 } 94 95 96 97 98 function plurals() { 99 return array( 100 array('Two forms, singular used for one only', 'nplurals=2; plural=n != 1;', array('danish','dutch','english','german','norwegian','swedish','estonian','finnish','greek','hebrew','italian','portuguese','spanish')), 101 array('One single form', 'nplurals=1; plural=0;', array('Hungarian','Japanese','Korean','Turkish')), 102 array('Two forms, singular used for zero and one', 'nplurals=2; plural=n>1;', array('french','brazilian portuguese')), 103 array('Three forms, special case for zero', 'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;', array('Latvian')), 104 array('Three forms, special cases for one and two', 'nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;', array('Gaeilge')), 105 array('Three forms, special case for numbers ending in 1[2-9]', 'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;', array('lithuanian')), 106 array('Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]', 'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;', explode(',', 'croatian,czech,russian,slovak,ukrainian')), 107 array('Three forms, special case for one and some numbers ending in 2, 3, or 4', 'nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;', array('polish')), 108 array('Four forms, special case for one and all numbers ending in 02, 03, or 04', 'nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;', array('slovenian')) 109 ); 110 } 111 } 112 113 114 if (!function_exists('array_combine')) { 115 function array_combine($a, $b) { 116 $c = array(); 117 if (is_array($a) && is_array($b)) 118 while (list(, $va) = each($a)) 119 if (list(, $vb) = each($b)) 120 $c[$va] = $vb; 121 else 122 break 1; 123 return $c; 124 } 125 } 126 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |