i18n, RT#12515
[freeside.git] / FS / FS / L10N / DBI.pm
diff --git a/FS/FS/L10N/DBI.pm b/FS/FS/L10N/DBI.pm
new file mode 100644 (file)
index 0000000..2f01a6a
--- /dev/null
@@ -0,0 +1,22 @@
+package FS::L10N::DBI;
+use base qw(FS::L10N);
+use strict;
+use FS::Msgcat;
+
+our %Lexicon = ();
+
+sub maketext {
+  my($lh, $key, @rest) = @_;
+
+  unless ( exists $Lexicon{$key} ) {
+    my $lang = $lh->language_tag;
+    $lang =~ s/-(\w*)/_\U$1/;
+    $Lexicon{$key} = FS::Msgcat::_gettext( $key, $lang );
+  }
+
+  $lh->SUPER::maketext($key, @rest);
+
+}
+
+1;
+