[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: Internationalisation and Currency
Quoting Christian J. Müller (cmueller@polinet.ch):
>
> Both exist: one currency, several languages (e.g. Switzerland, EC with
> Euro) and one language, several currencies (e.g. english, USD, UKP
> etc.). I have established one column for each language/currency pair in
> my locale.asc. I admit that this results in an inflated locale.asc file.
> You could also set your country/currency default and then change
> currency as required with the [setlocale language= xxx
> currency=xxx][/setlocale] or the [page
> process/locale/xxx/currency/xxx/page/catalog] tags as described in the
> docs under "Internationalization", "Setting the locale".
> I agree that a separation of language and currency would be a more
> elegant solution.
I assume you are talking about not having to repeat the
mon_decimal_point and mon_thousands_sep and currency_symbol.
(If you don't require that, the current setup will suffice).
That allows [setlocale locale=de_DE currency=eu_EU] to only
change the number and symbol but not change the mon_decimal_point etc.
A simple change to Vend::Util::setlocale will enable that:
if ($currency) {
my $curr = $Vend::Cfg->{Locale_repository}{$currency};
for(@Vend::Config::Locale_directives_currency) {
$Vend::Cfg->{$_} = $curr->{$_}
if defined $curr->{$_};
}
@{$Vend::Cfg->{Locale}}{@Vend::Config::Locale_keys_currency} =
@{$curr}{@Vend::Config::Locale_keys_currency};
}
should become
if ($currency) {
my $curr = $Vend::Cfg->{Locale_repository}{$currency};
for(@Vend::Config::Locale_directives_currency) {
$Vend::Cfg->{$_} = $curr->{$_}
if defined $curr->{$_};
}
@{$Vend::Cfg->{Locale}}{@Vend::Config::Locale_keys_currency} =
@{$curr}{ grep defined $curr->{$_},
@Vend::Config::Locale_keys_currency};
}
i.e.
< @{$curr}{@Vend::Config::Locale_keys_currency};
---
> @{$curr}{ grep defined $curr->{$_},
> @Vend::Config::Locale_keys_currency};
That will retain everything that you don't explicitly set (already
the behavior for PriceDivide, PriceField, and friends).
I will probably add this as an option in MV4 -- I am going to
redo the locale mechanism completely because of the easy
new action capability (i.e. /de_DE/ as a standard way to select
any page for that locale, defineable by the user). Don't worry, all
of your [L] and [LC] stuff will still work, and Locale definitions
won't change. 8-)
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
131 Willow Lane, Floor 2 | || _ \
It's a little-known fact Oxford, OH 45056 | || |_) |
that the Y1K problem caused <mikeh@minivend.com> |___| _ <
the Dark Ages. -- unknown 513.523.7621 FAX 7501 |_| \_\