[Bast-commits] r3772 - trunk/Locale-Object/docs
castaway at dev.catalyst.perl.org
castaway at dev.catalyst.perl.org
Fri Sep 21 15:20:58 GMT 2007
Author: castaway
Date: 2007-09-21 15:20:57 +0100 (Fri, 21 Sep 2007)
New Revision: 3772
Added:
trunk/Locale-Object/docs/localedata.pod
Log:
Initial thoughts
Added: trunk/Locale-Object/docs/localedata.pod
===================================================================
--- trunk/Locale-Object/docs/localedata.pod (rev 0)
+++ trunk/Locale-Object/docs/localedata.pod 2007-09-21 14:20:57 UTC (rev 3772)
@@ -0,0 +1,85 @@
+=head1 NAME
+
+localedata.pod - docs on the data extracted from the locale database
+
+=head1 NOTES
+
+The POSIX locale data contains the following information:
+
+ perl -Mlocale -MPOSIX=locale_h -MData::Dumper -le'setlocale(LC_ALL, "en_GB"); print Dumper(localeconv)'
+
+ $VAR1 = {
+ 'n_sep_by_space' => 0,
+ 'thousands_sep' => ',',
+ 'p_sep_by_space' => 0,
+ 'grouping' => '',
+ 'p_cs_precedes' => 1,
+ 'int_frac_digits' => 2,
+ 'mon_grouping' => '',
+ 'n_sign_posn' => 1,
+ 'currency_symbol' => '£',
+ 'int_curr_symbol' => 'GBP ',
+ 'negative_sign' => '-',
+ 'p_sign_posn' => 1,
+ 'frac_digits' => 2,
+ 'n_cs_precedes' => 1,
+ 'decimal_point' => '.',
+ 'mon_thousands_sep' => ',',
+ 'mon_decimal_point' => '.'
+ };
+
+L<http://www.gnu.org/software/libc/manual/html_node/General-Numeric.html#General-Numeric> , L<http://www.gnu.org/software/libc/manual/html_node/Currency-Symbol.html#Currency-Symbol> and L<http://www.gnu.org/software/libc/manual/html_node/Sign-of-Money-Amount.html#Sign-of-Money-Amount> describe what these values are used for when formatting currencies.
+
+L<Number::Format> will take some of these values and produce a relevantly formatted number. However it does not grok the variables which relate to the positioning of the currency symbol and the negative or positive signs. Neither does it accept alternative groupings as given by mon_grouping/grouping. We could ignore these and default to the 3er groupings.. We can convert the n_sign_posn values to NEG_FORMAT for Number::Format.
+
+We could also write a new subclass for L<Math::Currency> which can already deal with all the separators and positioning details of locales, but currently cant tell the difference between euro for en_IE and euro for de_DE. (meh)
+
+We should optionally do either international or national formatting. (Falling back to national settings when the int_ versions are missing).
+
+We should optionally remove the currency sign altogether.
+
+We should allow the user to provide defaults in the case that data for an entire locale is missing.
+
+We should allow formatting of one currency according to another locales rules. (i.e. allow the currency symbol to be one that isnt the one in the locale data).
+
+We make a new table for this data, linked to the existing country, language and currency tables.
+
+ CREATE TABLE locales (
+ lang_code char(2), # en
+ country_code char(2), # GB
+ currency_code char(3), # GBP
+ decimal_point char(1),
+ mon_decimal_point char(1), # '.'
+ thousands_sep char(1), # ','
+ mon_thousands_sep char(1), # ','
+ grouping char(??), # \3
+ mon_grouping char(??), # \3
+ frac_digits smallint, # digits after decimal point (2)
+ int_frac_digits smallint,
+ currency_symbol char(4),
+# int_curr_symbol # -> currency_code
+ p_cs_precedes smallint, # 1 if symbol precedes amount
+ n_cs_precedes smallint,
+ int_p_cs_precedes smallint,
+ int_n_cs_precedes smallint,
+ p_sep_by_space smallint, # 1 if there's a space between symbol and amount
+ n_sep_by_space smallint,
+ int_p_sep_by_space smallint,
+ int_n_sep_by_space smallint,
+ positive_sign char(1), # positive value indicator
+ negative_sign char(1), # negative value indicator
+ p_sign_posn smallint, # 0 symbol and quantity surrounded by parens
+ n_sign_posn smallint, # 1 sign before quantity and symbol
+ int_p_sign_posn smallint, # 2 sign after quantity and symbol
+ int_n_sign_posn smallint, # 3 sign right before symbol
+ # 4 sign right after symbol
+ # char_max - unspecified
+
+ PRIMARY KEY (lang_code, country_code)
+ );
+
+
+
+
+
+=cut
\ No newline at end of file
More information about the Bast-commits
mailing list