pluf2

pluf2 Commit Details


Date:2009-07-13 04:45:20 (15 years 5 months ago)
Author:Loic d'Anterroches
Branch:master
Commit:06fd8001b9b17d099124438db1fb9de9fa81d1bc
Parents: f67ef4ce2835e03fa2a97f2018fbc83bf32eeccd
Message:Added a tag with practical l10n functions.

Changes:

File differences

src/Pluf/L10n/Tag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Plume Framework, a simple PHP Application Framework.
# Copyright (C) 2001-2007 Loic d'Anterroches and contributors.
#
# Plume Framework is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Plume Framework is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* Template tag to display the country/language from the code.
*
* @param string Iso code
* @param string ('country') or 'lang'
* @param bool Print the result (true)
*/
class Pluf_L10n_Tag extends Pluf_Template_Tag
{
function start($code, $what='country', $echo=true)
{
if ($what == 'country') {
$cn = Pluf_L10n::getCountryCodes(true);
} else {
$cn = Pluf_L10n::getNativeLanguages();
}
if (!empty($cn[$code])) {
if ($echo) {
echo $cn[$code];
} else {
return $cn[$code];
}
}
}
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05631s using 13 queries.