Localization is now in an external file
diff --git a/kalamar.conf b/kalamar.conf
index 926d816..085fdf4 100644
--- a/kalamar.conf
+++ b/kalamar.conf
@@ -1,15 +1,3 @@
-# Based on Mojolicious::Plugin::Number::Commify
-my $THOUSAND_SEP_RE = qr/(
- ^[-+]? # beginning of number.
- \d+? # first digits before first comma
- (?= # followed by, (but not included in the match) :
- (?>(?:\d{3})+) # some positive multiple of three digits.
- (?!\d) # an *exact* multiple, not x * 3 + 1 or whatever.
- )| # or:
- \G\d{3} # after the last group, get three digits
- (?=\d) # but they have to have more digits after them.
-)/x;
-
{
Kalamar => {
'api-0.1' => 'http://10.0.10.13:7070/api/v0.1/'
@@ -46,84 +34,12 @@
page => '<span>{page}</span>'
},
Localize => {
- dict => {
- _ => sub { $_->locale },
- de => {
- numf => sub {
- shift;
- my %val = @_;
- my $num = $val{number} or return 0;
- $num =~ s/$THOUSAND_SEP_RE/$1\./g;
- return $num;
- },
- about => 'Über KorAP',
- login => 'Anmelden',
- searchtitle => 'KorAP: Finde "<%== $q %>" (<%= $ql %>)',
- searchplaceholder => 'Finde ...',
- go => 'Los!',
- in => 'in',
- by => 'von',
- with => 'mit',
- glimpse => {
- -short => 'Stichprobe',
- desc => 'Zeige nur die ersten Treffer in beliebiger Reihenfolge'
- },
- faq => 'Häufige Fragen',
- tutorial => 'Einführung',
- pubOn => 'veröffentlicht am',
- matchCount => 'Treffer',
- noMatches => 'Es wurden keine Treffer für <code><%= stash("q") %></code> gefunden.',
- notFound => '404 - Seite nicht gefunden',
- jsFile => 'kalamar-<%= $Kalamar::VERSION %>-de.js',
- underConstruction => 'In Vorbereitung!',
- korap => {
- -short => 'KorAP',
- desc => 'KorAP - Korpusanalyseplattform der nächsten Generation',
- overview => 'KorAP - Übersicht',
- },
- template => {
- intro => 'de/intro'
- }
- },
- -en => {
- numf => sub {
- shift;
- my %val = @_;
- my $num = $val{number} or return 0;
- $num =~ s/$THOUSAND_SEP_RE/$1\,/g;
- return $num;
- },
- about => 'About KorAP',
- login => 'Login',
- go => 'Go!',
- searchtitle => 'KorAP: Find "<%== $q %>" (<%= $ql %>)',
- searchplaceholder => 'Find ...',
- in => 'in',
- by => 'by',
- with => 'with',
- pubOn => 'published on',
- matchCount => '<%= num($found, "match", "matches") %>',
- noMatches => 'There were no matches for <code><%= stash("q") %></code>.',
- notFound => '404 - Page not found',
- glimpse => {
- -short => 'Sample',
- desc => 'Just show the first matches in arbitrary order'
- },
- faq => 'F.A.Q.',
- underConstruction => 'Under Construction!',
- tutorial => 'Tutorial',
- korap => {
- -short => 'KorAP',
- desc => 'KorAP - Corpus Analysis Platform',
- overview => 'KorAP - Overview'
- }
- }
- }
+ resources => ['kalamar.dict']
},
MailException => {
from => join('@', 'korap', 'ids-mannheim.de'),
to => join('@', 'korap', 'ids-mannheim.de'),
- subject => '[KorAP] Testbed crashed'
+ subject => '[KorAP] Kalamar crashed'
},
# Doesn't make much sense when published, but who cares ...
'TagHelpers-MailToChiffre' => {
diff --git a/kalamar.dict b/kalamar.dict
new file mode 100644
index 0000000..971407d
--- /dev/null
+++ b/kalamar.dict
@@ -0,0 +1,85 @@
+# Based on Mojolicious::Plugin::Number::Commify
+my $THOUSAND_SEP_RE = qr/(
+ ^[-+]? # beginning of number.
+ \d+? # first digits before first comma
+ (?= # followed by, (but not included in the match) :
+ (?>(?:\d{3})+) # some positive multiple of three digits.
+ (?!\d) # an *exact* multiple, not x * 3 + 1 or whatever.
+ )| # or:
+ \G\d{3} # after the last group, get three digits
+ (?=\d) # but they have to have more digits after them.
+)/x;
+
+{
+ _ => sub { $_->locale },
+ de => {
+ numf => sub {
+ shift;
+ my %val = @_;
+ my $num = $val{number} or return 0;
+ $num =~ s/$THOUSAND_SEP_RE/$1\./g;
+ return $num;
+ },
+ about => 'Über KorAP',
+ login => 'Anmelden',
+ searchtitle => 'KorAP: Finde "<%== $q %>" (<%= $ql %>)',
+ searchplaceholder => 'Finde ...',
+ go => 'Los!',
+ in => 'in',
+ by => 'von',
+ with => 'mit',
+ glimpse => {
+ -short => 'Stichprobe',
+ desc => 'Zeige nur die ersten Treffer in beliebiger Reihenfolge'
+ },
+ faq => 'Häufige Fragen',
+ tutorial => 'Einführung',
+ pubOn => 'veröffentlicht am',
+ matchCount => 'Treffer',
+ noMatches => 'Es wurden keine Treffer für <code><%= stash("q") %></code> gefunden.',
+ notFound => '404 - Seite nicht gefunden',
+ jsFile => 'kalamar-<%= $Kalamar::VERSION %>-de.js',
+ underConstruction => 'In Vorbereitung!',
+ korap => {
+ -short => 'KorAP',
+ desc => 'KorAP - Korpusanalyseplattform der nächsten Generation',
+ overview => 'KorAP - Übersicht',
+ },
+ template => {
+ intro => 'de/intro'
+ }
+ },
+ -en => {
+ numf => sub {
+ shift;
+ my %val = @_;
+ my $num = $val{number} or return 0;
+ $num =~ s/$THOUSAND_SEP_RE/$1\,/g;
+ return $num;
+ },
+ about => 'About KorAP',
+ login => 'Login',
+ go => 'Go!',
+ searchtitle => 'KorAP: Find "<%== $q %>" (<%= $ql %>)',
+ searchplaceholder => 'Find ...',
+ in => 'in',
+ by => 'by',
+ with => 'with',
+ pubOn => 'published on',
+ matchCount => '<%= num($found, "match", "matches") %>',
+ noMatches => 'There were no matches for <code><%= stash("q") %></code>.',
+ notFound => '404 - Page not found',
+ glimpse => {
+ -short => 'Sample',
+ desc => 'Just show the first matches in arbitrary order'
+ },
+ faq => 'F.A.Q.',
+ underConstruction => 'Under Construction!',
+ tutorial => 'Tutorial',
+ korap => {
+ -short => 'KorAP',
+ desc => 'KorAP - Corpus Analysis Platform',
+ overview => 'KorAP - Overview'
+ }
+ }
+};
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 60833a8..7103fe9 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -97,6 +97,9 @@
my $text = $doc->get('/:text_id');
my $match = $text->get('/:match_id');
$match->to('search#match_info')->name('match');
+
+ # Default user is called 'korap'
+ # $r->route('/user/:user/:collection')
};