1
# See bottom of file for license and copyright information
2
# Foswiki::I18N::Fallback - a fallback class for when
3
# Locale::Maketext isn't available.
5
package Foswiki::I18N::Fallback;
6
use base 'Foswiki::I18N';
10
my $this = bless( {}, $class );
16
# No data, nothing to do.
17
# Must call SUPER finish to avoid memory leaks
19
$this->SUPER::finish(@_);
23
my ( $this, $text, @args ) = @_;
25
return '' unless $text;
27
# substitute parameters:
28
$text =~ s/\[\_(\d+)\]/$args[$1-1]/ge;
30
# unescape escaped square brackets:
31
$text =~ s/~(\[|\])/$1/g;
35
s/\[\*,\_(\d+),([^,]+)(,([^,]+))?\]/_handlePlurals($args[$1-1],$2,$4)/ge;
41
my ( $number, $singular, $plural ) = @_;
43
# bad hack, but Locale::Maketext does it the same way ;)
48
: ( $plural ? ($plural) : ( $singular . 's' ) ) );
55
sub enabled_languages {
57
return $this->{enabled_languages};
61
my ( $this, $text ) = @_;
66
my ( $this, $text ) = @_;
72
# Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/
74
# Copyright (C) 2008-2009 Foswiki Contributors. All Rights Reserved.
75
# Foswiki Contributors are listed in the AUTHORS file in the root
76
# of this distribution. NOTE: Please extend that file, not this notice.
78
# Additional copyrights apply to some or all of the code in this
81
# Copyright (C) 1999-2007 TWiki Contributors. All Rights Reserved.
82
# TWiki Contributors are listed in the AUTHORS file in the root
83
# of this distribution. NOTE: Please extend that file, not this notice.
85
# This program is free software; you can redistribute it and/or
86
# modify it under the terms of the GNU General Public License
87
# as published by the Free Software Foundation; either version 2
88
# of the License, or (at your option) any later version. For
89
# more details read LICENSE in the root of this distribution.
91
# This program is distributed in the hope that it will be useful,
92
# but WITHOUT ANY WARRANTY; without even the implied warranty of
93
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
95
# As per the GPL, removal of this notice is prohibited.