1 # LANGUAGE.awk -- awk script to generate LANGUAGE.tbl -*- coding: utf-8; -*-
3 # National Institute of Advanced Industrial Science and Technology (AIST)
4 # Registration Number H15PRO112
6 # This file is part of the m17n database; a sub-part of the m17n
9 # The m17n library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1 of
12 # the License, or (at your option) any later version.
14 # The m17n library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with the m17n library; if not, write to the Free
21 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 # Boston, MA 02110-1301, USA.
25 print ";; LANGUAGE.tbl -- ISO639 Language Code -*- mode:lisp; coding:utf-8; -*-";
26 print ";; Copyright (C) 2007";
27 print ";; National Institute of Advanced Industrial Science and Technology (AIST)";
28 print ";; Registration Number H15PRO112";
30 print ";; This file is part of the m17n database; a sub-part of the m17n";
33 print ";; The m17n library is free software; you can redistribute it and/or";
34 print ";; modify it under the terms of the GNU Lesser General Public License";
35 print ";; as published by the Free Software Foundation; either version 2.1 of";
36 print ";; the License, or (at your option) any later version.";
38 print ";; The m17n library is distributed in the hope that it will be useful,";
39 print ";; but WITHOUT ANY WARRANTY; without even the implied warranty of";
40 print ";; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU";
41 print ";; Lesser General Public License for more details.";
43 print ";; You should have received a copy of the GNU Lesser General Public";
44 print ";; License along with the m17n library; if not, write to the Free";
45 print ";; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,";
46 print ";; Boston, MA 02110-1301, USA.";
48 print ";; The file format is this:";
49 print ";; (ISO639-2 ISO639-1 \"ENGLISH-NAME\" [ \"NATIVE-NAME\" [ \"EXTRA-CHARS\" ]]) ...";
50 print ";; ISO639-2: 3-letter language code of ISO639-2.";
51 print ";; ISO639-1: 2-letter language code of ISO639-1, or nil if it doesn't exist.";
52 print ";; ENGLISH-NAME: English name of the language.";
53 print ";; NATIVE-NAME: Native name of the language.";
54 print ";; EXTRA-CHARS: Extra characters that uniquifies the language.";
56 print ";; ISO639-2 and ISO639-1 are extracted from ISO-639-2.txt.";
57 print ";; ENGLISH-NAME and NATIVE-NAME are mainly extracted from CLDR,";
58 print ";; but are also supplemented from these sites:";
60 while (getline < "native.txt") {
65 } else if ($0 ~ /^;;/) {
69 while (getline < "native.ext") {
74 while (getline < "en.lnm") {
75 split($0, array, "[( ]");
77 split($0, array, "\"");
78 ENGLISH[code] = array[2];
82 /^[a-z][a-z][a-z]\|/ {
85 if (code2 == "" || code2 == "NULL")
87 native = NATIVE[code2];
89 native = NATIVE[code3];
92 name = ENGLISH[code2];
94 name = ENGLISH[code3];
95 # if (name == "Greek, Modern (1453-)")
98 # gsub("; .*", "", name);
99 # gsub(" \\(Other\\)$", "", name);
100 # gsub(" languages$", "", name);
101 # gsub(" Languages$", "", name);
102 # if (name ~ /\(.*[0-9].*\)$/)
103 # gsub(" \\([^)]*\\)$", "", name);
105 # split(name, array, ", ");
106 # name = array[2] " " array[1];
109 printf "(%s %-3s \"%s\"", code3, code2, name;
111 printf " \"%s\"", native;
112 else if (chars != "")
115 printf " \"%s\"", chars;