]>
git.agnieray.net Git - galette.git/blob - galette/includes/i18n.inc.php
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
10 * Copyright © 2003-2023 The Galette Team
12 * This file is part of Galette (http://galette.tuxfamily.org).
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
30 * @author Frédéric Jacquot <unknown@unknow.com>
31 * @author Georges Khaznadar (i18n using gettext) <unknown@unknow.com>
32 * @author Johan Cwiklinski <johan@x-tnd.be>
33 * @copyright 2003-2023 The Galette Team
34 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
35 * @link http://galette.tuxfamily.org
36 * @since Available since 0.62
39 if (! defined ( 'GALETTE_ROOT' )) {
40 die ( "Sorry. You can't access directly to this file" );
44 use Galette\Core\Galette
;
48 $language = $i18n -> getLongID ();
51 * Translate a string, or return original one
53 * @param string $string The string to translate
54 * @param string $domain Translation domain. Default to galette
55 * @param boolean $nt Indicate not translated strings; defaults to true
59 function _T ( $string , $domain = 'galette' , $nt = true )
61 global $language , $installer , $translator , $l10n ;
65 'Cannot translate empty strings..' ,
71 if ( strpos ( $domain , 'route' ) !== false ) {
73 'Routes are no longer translated, return string.' ,
79 if ( $translator -> translationExists ( $string , $domain )) {
80 return $translator -> translate ( $string , $domain );
84 if (! isset ( $installer ) ||
$installer !== true ) {
85 $trans = $l10n -> getDynamicTranslation (
94 if ( Galette
:: isDebugEnabled () && $nt === true ) {
95 $trans .= ' (not translated)' ;
102 * Pluralized translation
104 * @param string $singular Singular form of the string to translate
105 * @param string $plural Plural form of the string to translate
106 * @param integer $count Number for count
107 * @param string $domain Translation domain. Default to galette
108 * @param boolean $nt Indicate not translated strings; defaults to true
112 function _Tn ( $singular , $plural , $count , $domain = 'galette' , $nt = true )
114 global $language , $installer , $translator , $l10n ;
116 if ( empty ( $singular ) ||
empty ( $plural )) {
118 'Cannot translate empty strings..' ,
121 return ( $count > 1 ?
$plural : $singular );
125 $translator -> translationExists ( $singular , $domain )
126 && $translator -> translationExists ( $plural , $domain )
128 $ret = $translator -> translatePlural (
137 if (! isset ( $installer ) ||
$installer !== true ) {
138 $trans = $l10n -> getDynamicTranslation (
139 ( $count > 1 ?
$plural : $singular ),
145 $trans = ( $count > 1 ?
$plural : $singular );
147 if ( Galette
:: isDebugEnabled () && $nt === true ) {
148 $trans .= ' (not translated)' ;
155 * Contextualized translation
157 * @param string $context Context
158 * @param string $string The string to translate
159 * @param string $domain Translation domain (defaults to galette)
160 * @param boolean $nt Indicate not translated strings; defaults to true
164 function _Tx ( $context , $string , $domain = 'galette' , $nt = true )
166 global $language , $installer , $translator , $l10n ;
168 $cstring = contextualizedString ( $string , $context );
169 $ret = _T ( $cstring , $domain );
170 if ( $ret == $cstring ) {
175 if (! isset ( $installer ) ||
$installer !== true ) {
176 $trans = $l10n -> getDynamicTranslation (
185 if ( Galette
:: isDebugEnabled () && $nt === true ) {
186 $trans .= ' (not translated)' ;
193 * Pluralized and contextualized translation
195 * @param string $context Context
196 * @param string $singular Singular form of the string to translate
197 * @param string $plural Plural form of the string to translate
198 * @param integer $count Number for count
199 * @param string $domain Translation domain. Default to galette
200 * @param boolean $nt Indicate not translated strings; defaults to true
204 function _Tnx ( $context , $singular , $plural , $count , $domain = 'galette' , $nt = true )
206 global $language , $installer , $translator , $l10n ;
208 $csingular = contextualizedString ( $singular , $context );
209 $cplural = contextualizedString ( $plural , $context );
217 if ( $ret == $csingular ) {
222 if ( $ret == $cplural ) {
228 if (! isset ( $installer ) ||
$installer !== true ) {
229 $trans = $l10n -> getDynamicTranslation (
230 ( $count > 1 ?
$cplural : $csingular ),
238 if ( Galette
:: isDebugEnabled () && $nt === true ) {
239 $trans .= ' (not translated)' ;
247 * Get contextualized strign (simalates pgettext)
249 * @param string $string The string to translate
250 * @param string $context The context
254 function contextualizedString ( $string , $context )
256 return "{ $string } \004 { $context }" ;
260 * Translate a string, without displaying not translated
262 * @param string $string The string to translate
263 * @param string $domain Translation domain. Default to false (will take default domain)
267 function __ ( $string , $domain = 'galette' )
269 return _T ( $string , $domain , false );
272 /**********************************************
273 * some constant strings found in the database *
274 **********************************************/
275 /** TODO: these string should be not be handled here */
276 $foo = _T ( "Realization:" );
277 $foo = _T ( "Graphics:" );
278 $foo = _T ( "Publisher:" );
279 $foo = _T ( "President" );
280 $foo = _T ( "Vice-president" );
281 $foo = _T ( "Treasurer" );
282 $foo = _T ( "Vice-treasurer" );
283 $foo = _T ( "Secretary" );
284 $foo = _T ( "Vice-secretary" );
285 $foo = _T ( "Active member" );
286 $foo = _T ( "Benefactor member" );
287 $foo = _T ( "Founder member" );
288 $foo = _T ( "Old-timer" );
289 $foo = _T ( "Legal entity" );
290 $foo = _T ( "Non-member" );
291 $foo = _T ( "Reduced annual contribution" );
292 $foo = _T ( "Company cotisation" );
293 $foo = _T ( "Donation in kind" );
294 $foo = _T ( "Donation in money" );
295 $foo = _T ( "Partnership" );
297 $foo = _T ( "english" );
298 $foo = _T ( "spanish" );
299 $foo = _T ( "annual fee" );
300 $foo = _T ( "annual fee (to be paid)" );
301 $foo = _T ( "company fee" );
302 $foo = _T ( "donation in kind" );
303 $foo = _T ( "donation in money" );
304 $foo = _T ( "partnership" );
305 $foo = _T ( "reduced annual fee" );
306 $foo = _T ( "Identity" );
307 $foo = _T ( "Galette-related data" );
308 $foo = _T ( "Contact information" );
312 $foo = _T ( "Identity:" );
313 $foo = _T ( "Galette-related data:" );
314 $foo = _T ( "Contact information:" );
315 $foo = _T ( "Society" );
316 $foo = _T ( 'Politeness' );
319 $foo = _T ( "** Galette identifier, if applicable" );
320 $foo = _T ( "* Only for compagnies" );
321 $foo = _T ( "Hereby, I agree to comply to %s association statutes and its rules." );
322 $foo = _T ( "At ................................................" );
323 $foo = _T ( "On .......... / .......... / .......... " );
324 $foo = _T ( "Username" );
325 $foo = _T ( "Email address" );
326 $foo = _T ( "Country" );
328 $foo = _T ( "Zip Code" );
329 $foo = _T ( "First name" );
330 $foo = _T ( "The minimum contribution for each type of membership are defined on the website of the association. The amount of donations are free to be decided by the generous donor." );
331 $foo = _T ( "Required membership:" );
332 $foo = _T ( "Complete the following form and send it with your funds, in order to complete your subscription." );
336 $foo = _T ( 'Association' );