derekovecs: add obvious parts of German localization
diff --git a/css/derekovecs.css b/css/derekovecs.css
index 262de83..c7e499b 100644
--- a/css/derekovecs.css
+++ b/css/derekovecs.css
@@ -285,6 +285,11 @@
font-family: "Univers LT Std 47 Cn Lt", "Univers LT Std 67 Cn Lt", "Roboto Condensed", "Univers LT Std 67 Cn Bold", "UniversLTStd-BoldCn", "Times", 'League Gothic', Impact, sans-serif;
}
+th, th .regular {
+ color: rgb(246,168,0);
+ font-family: "Univers LT Std 47 Cn Lt", "Univers LT Std 67 Cn Lt", "Roboto Condensed", "Univers LT Std 67 Cn Bold", "UniversLTStd-BoldCn", "Times", 'League Gothic', Impact, sans-serif;
+}
+
p.citation {
font-size: 8pt;
color: #999999;
diff --git a/templates/index.html.ep b/templates/index.html.ep
index b6ed132..f3ec1ec 100644
--- a/templates/index.html.ep
+++ b/templates/index.html.ep
@@ -315,7 +315,7 @@
$(function(){
$("#dropdownoptions").dialog({
- title: "Options",
+ title: "<%= loc 'Options' %>",
autoOpen: false,
modal: false,
draggable: false,
@@ -323,10 +323,10 @@
width: "auto",
resizable: false,
buttons: {
- "Cancel": function() {
+ "<%= loc 'Cancel'%>": function() {
$( this ).dialog( "close" );
},
- "Apply": function() {
+ "<%= loc 'Apply' %>": function() {
window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
}
}
@@ -696,10 +696,10 @@
</div>
<div id="options" class="widget">
<form id="queryform">
- <input id="word" type="text" name="word" placeholder="Word(s) to be searched" value="<%= $word %>"
- title="When looking for multiple words use spaces as separators to search around the average vector and | as separator to get the neighbours for each word."/>
- <input id="SEARCH" type="button" value="SEARCH">
- <input type="button" id="showoptions" name="showoptions" value="Options" />
+ <input id="word" type="text" name="word" placeholder="<%= loc 'words_to_be_searched' %>" value="<%= $word %>"
+ title="<%= loc 'search_description' %>"/>
+ <input id="SEARCH" type="button" value="<%= loc 'SEARCH' %>">
+ <input type="button" id="showoptions" name="showoptions" value="<%= loc 'Options' %>" />
</form>
<div id="dropdownoptions" style="display: none">
<form id="optionsform">
@@ -742,9 +742,9 @@
% if($mergedEnd && $distantWords) {
<li><a href="#tabs-0" title="Cos offsets of the words furthest away from their position in the reference corpus."">Offsets</a></li>
% }
- <li><a href="#tabs-1">Semantics (TSNE-map)</a></li>
- <li><a href="#tabs-2">Semantics (SOM)</a></li>
- <li><a href="#tabs-3">Syntagmatic (collocates)</a></li>
+ <li><a href="#tabs-1"><%= loc 'paradigmatic_tsne' %></a></li>
+ <li><a href="#tabs-2"><%= loc 'paradigmatic_som' %></a></li>
+ <li><a href="#tabs-3"><%= loc 'syntagmatic' %></a></li>
</ul>
% if($mergedEnd && $distantWords) {
<div id="tabs-0" style="display: flex; padding: 5px; flex-flow: row wrap;">
@@ -862,7 +862,7 @@
<th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
<th title="Co-norm of the column-normalized activations over the colunns selected by the auto-focus." align="right">⊥(a/c)</th>
<th title="Sum of the activations over the whole window normalized by the total window sum (no auto-focus)." align="right">Σa/Σw</th>
- <th align="left">collocate (by w2v)</th>
+ <th align="left"><%= loc 'collocate_w2v' %></th>
% }
</tr>
</thead>
@@ -898,13 +898,13 @@
<th id="logdice_tt">LD</th>
<th id="logdiceaf_tt">LDaf</th>
<th id="delta_tt" title="Delta to log-Dice score in reference corpus. ⚠: If the collocate is not within the top 200 of the reference corpus, a reference value of min(lD)-0.1 is assumed.">Δ</th>
- <th id="af_win" title="Positions around the target word that are selected by the auto-focus function are marked with ◾. Positions at which the collocate appears at least once are marked with ◽.">af-window</th>
+ <th id="af_win" title="Positions around the target word that are selected by the auto-focus function are marked with ◾. Positions at which the collocate appears at least once are marked with ◽."><span class="regular"><%= loc 'af_window' %></span></th>
<th title="PMI³ restricted to left neighbour">l-PMI³</th>
<th title="PMI³ restricted to right neighbour">r-PMI³</th>
<th title="nPMI restricted to left neighbour">l-nPMI</th>
<th title="nPMI restricted to right neighbour">r-nPMI</th>
<th id="rawfreq_tt" title="raw frequency sum of collocation within window">raw</th>
- <th>collocate (by CA)</th>
+ <th><%= loc 'collocate_ca' %></th>
</tr>
% }
</thead>
@@ -946,6 +946,9 @@
Calculations are based on a word embedding model trained with <a href="https://code.google.com/p/word2vec/">word2vec</a> using the following parameters: <%= $training_args %>
% }
</div>
+ % } else {
+ <div class="info">
+ </div>
% }
</body>
</html>
diff --git a/w2v-server.dict b/w2v-server.dict
new file mode 100644
index 0000000..c4b43f8
--- /dev/null
+++ b/w2v-server.dict
@@ -0,0 +1,58 @@
+# Dictionary template generated Wed, 04 Dec 2019 13:37:00 GMT
+# 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;
+ },
+ Cancel => 'Abbrechen',
+ Apply => 'Anwenden',
+ Options => 'Optionen',
+ SEARCH => 'SUCHE',
+ words_to_be_searched => 'Zu suchende Wortform(en)',
+ search_description => 'Wenn sie mehrere Wortformen kontrastieren wollen, trennen Sie diese mit Leerzeichen, um um den Mittelpunkt der Alternativen herum nach ähnlichen Wörtern zu suchen und mit "|", um die Nachbarn zu allen angegebenen Wortformen zur erhalten.',
+ paradigmatic_tsne => 'Paradigmatisch (t-SNE)',
+ paradigmatic_som => 'Paradigmatisch (SOM)',
+ syntagmatic => 'Syntagmatisch',
+ collocate_w2v => "Kollokat (W2V)",
+ collocate_ca => "Kollokat (KA)",
+ af_window => "AF-Fenster"
+ },
+ -en => {
+ numf => sub {
+ shift;
+ my %val = @_;
+ my $num = $val{number} or return 0;
+ $num =~ s/$THOUSAND_SEP_RE/$1\,/g;
+ return $num;
+ },
+ Cancel => 'Cancel',
+ Apply => 'Apply',
+ Options => 'Options',
+ SEARCH => 'SEARCH',
+ words_to_be_searched => 'Word(s) to be searched',
+ search_description => 'When looking for multiple words use spaces as separators to search around the average vector and | as separator to get the neighbours for each word.',
+ paradigmatic_tsne => 'Paradigmatic (t-SNE)',
+ paradigmatic_som => 'Paradigmatic (SOM)',
+ syntagmatic => 'Syntagmatic',
+ collocate_w2v => "Collocate (W2V)",
+ collocate_ca => "Collocate (CA)",
+ af_window => "AF window"
+ }
+};
diff --git a/w2v-server.pl b/w2v-server.pl
index 4aa687c..7073183 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -15,7 +15,13 @@
plugin 'Log::Access';
plugin "RequestBase";
-
+#plugin 'AutoReload';
+plugin Localize => {
+ dict => {
+ _ => sub { $_->locale },
+ },
+ resources => ['w2v-server.dict']
+};
our $opt_i = 0; # latin1-input?
our $opt_l = undef;
our $opt_p = 5676;
@@ -337,6 +343,7 @@
return $str;
});
-$daemon->run; # app->start;
+$daemon->run;
+# app->start;
-exit;
+# exit;