Match Wikipedia subdomains and common browser headers.
CREATE TABLE word (
form text NOT NULL,
alt text[],
- lang text NOT NULL DEFAULT 'eng',
+ lang text NOT NULL DEFAULT 'en',
cat integer REFERENCES word (id),
ref integer REFERENCES word (id),
prio smallint NOT NULL DEFAULT '1',
COMMENT ON COLUMN word.form IS 'preferred textual representation';
COMMENT ON COLUMN word.alt IS 'alternate forms with equivalent meaning';
-COMMENT ON COLUMN word.lang IS 'ISO 639-3 language code';
+COMMENT ON COLUMN word.lang IS 'ISO 639 language code matching wikipedia subdomain';
COMMENT ON COLUMN word.cat IS 'hierarchical classification';
-COMMENT ON COLUMN word.ref IS 'reference to equivalent eng translation';
+COMMENT ON COLUMN word.ref IS 'reference to equivalent en translation';
COMMENT ON COLUMN word.prio IS 'difficulty level or importance; lower values have precedence';
COMMENT ON COLUMN word.grade IS 'ascending hierarchical order, preceding default alphabetical';
COMMENT ON COLUMN word.cover IS 'highlight if selected';
<(common.inc.plp)><:
-my $wordlist = 'wordlist.eng.inc.pl';
+my $wordlist = 'wordlist.en.inc.pl';
my $limit = $get{v} // (exists $get{v} ? 4 : 3);
Html({
$name = "<q>$name</q>" if $name =~ s/\?$//;
$name = "<figcaption>$name</figcaption>";
- if ($imgname and -e ($img = "data/word/eng/$imgname.jpg")) {
+ if ($imgname and -e ($img = "data/word/en/$imgname.jpg")) {
$name .= sprintf '<img src="/%s" alt="%s" />', $img, $imgname;
}
return sprintf '<figure%s>%s</figure>', $hidden && !exists $get{v} && ' hidden', $name;
wpbutton.append('Download');
wpbutton.onclick = () => {
let wptitle = wpinput.value || document.getElementById('form').value;
- let wplang = document.getElementById('lang').value.substr(0, 2); // crude iso-639-3→2
+ let wplang = document.getElementById('lang').value;
let wpapi = `https://${wplang}.wikipedia.org/w/api.php`;
let wppage = wpapi+'?action=parse&format=json&origin=*&prop=text&page='+wptitle;
fetch(wppage).then(res => res.json()).then(json => {
wpbutton.append('Visit');
wpbutton.onclick = () => {
let wptitle = wpinput.value || document.getElementById('form').value;
- let wplang = document.getElementById('lang').value.substr(0, 2); // crude iso-639-3→2
+ let wplang = document.getElementById('lang').value;
let wpurl = `https://${wplang}.wikipedia.org/wiki/${wptitle}`;
window.open(wpurl, 'sheet-wikipedia').focus();
return false;
} or Abort('Database error', 501, $@);
my %lang = (
- nld => ["\N{REGIONAL INDICATOR SYMBOL LETTER N}\N{REGIONAL INDICATOR SYMBOL LETTER L}", 'dutch'],
- eng => ["\N{REGIONAL INDICATOR SYMBOL LETTER G}\N{REGIONAL INDICATOR SYMBOL LETTER B}", 'english'],
- epo => ['<span style="color:green">★</span>', 'esperanto'],
+ nl => ["\N{REGIONAL INDICATOR SYMBOL LETTER N}\N{REGIONAL INDICATOR SYMBOL LETTER L}", 'nederlands'],
+ en => ["\N{REGIONAL INDICATOR SYMBOL LETTER G}\N{REGIONAL INDICATOR SYMBOL LETTER B}", 'english'],
+ eo => ['<span style="color:green">★</span>', 'esperanto'],
+ ru => ["\N{REGIONAL INDICATOR SYMBOL LETTER R}\N{REGIONAL INDICATOR SYMBOL LETTER U}", 'русский'],
);
my @wordcols = pairkeys
my %wordcol = (
sub imagepath {
my ($row, $col) = @_;
return "data/word/org/$row->{id}.jpg" if $col eq 'source';
- return "data/word/eng/$row->{form}.jpg" if $col eq 'thumb';
+ return "data/word/en/$row->{form}.jpg" if $col eq 'thumb';
return;
}
}