erc-lang.el 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. ;;; erc-lang.el --- provide the LANG command to ERC
  2. ;; Copyright (C) 2002, 2004, 2006-2012 Free Software Foundation, Inc.
  3. ;; Author: Alex Schroeder <alex@gnu.org>
  4. ;; Maintainer: Alex Schroeder <alex@gnu.org>
  5. ;; Version: 1.0.0
  6. ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcLang
  7. ;; Keywords: comm languages processes
  8. ;; This file is part of GNU Emacs.
  9. ;; GNU Emacs is free software: you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation, either version 3 of the License, or
  12. ;; (at your option) any later version.
  13. ;; GNU Emacs is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;; GNU General Public License for more details.
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  19. ;;; Commentary:
  20. ;; This provides two commands: `language' is for everyday use, and
  21. ;; `erc-cmd-LANG' provides the /LANG command to ERC.
  22. ;;; Code:
  23. (require 'erc)
  24. (defvar iso-638-languages
  25. '(("aa" . "Afar")
  26. ("ab" . "Abkhazian")
  27. ("af" . "Afrikaans")
  28. ("am" . "Amharic")
  29. ("ar" . "Arabic")
  30. ("as" . "Assamese")
  31. ("ay" . "Aymara")
  32. ("az" . "Azerbaijani")
  33. ("ba" . "Bashkir")
  34. ("be" . "Byelorussian")
  35. ("bg" . "Bulgarian")
  36. ("bh" . "Bihari")
  37. ("bi" . "Bislama")
  38. ("bn" . "Bengali; Bangla")
  39. ("bo" . "Tibetan")
  40. ("br" . "Breton")
  41. ("ca" . "Catalan")
  42. ("co" . "Corsican")
  43. ("cs" . "Czech")
  44. ("cy" . "Welsh")
  45. ("da" . "Danish")
  46. ("de" . "German")
  47. ("dz" . "Bhutani")
  48. ("el" . "Greek")
  49. ("en" . "English")
  50. ("eo" . "Esperanto")
  51. ("es" . "Spanish")
  52. ("et" . "Estonian")
  53. ("eu" . "Basque")
  54. ("fa" . "Persian")
  55. ("fi" . "Finnish")
  56. ("fj" . "Fiji")
  57. ("fo" . "Faroese")
  58. ("fr" . "French")
  59. ("fy" . "Frisian")
  60. ("ga" . "Irish")
  61. ("gd" . "Scots Gaelic")
  62. ("gl" . "Galician")
  63. ("gn" . "Guarani")
  64. ("gu" . "Gujarati")
  65. ("ha" . "Hausa")
  66. ("he" . "Hebrew (formerly iw)")
  67. ("hi" . "Hindi")
  68. ("hr" . "Croatian")
  69. ("hu" . "Hungarian")
  70. ("hy" . "Armenian")
  71. ("ia" . "Interlingua")
  72. ("id" . "Indonesian (formerly in)")
  73. ("ie" . "Interlingue")
  74. ("ik" . "Inupiak")
  75. ("is" . "Icelandic")
  76. ("it" . "Italian")
  77. ("iu" . "Inuktitut")
  78. ("ja" . "Japanese")
  79. ("jw" . "Javanese")
  80. ("ka" . "Georgian")
  81. ("kk" . "Kazakh")
  82. ("kl" . "Greenlandic")
  83. ("km" . "Cambodian")
  84. ("kn" . "Kannada")
  85. ("ko" . "Korean")
  86. ("ks" . "Kashmiri")
  87. ("ku" . "Kurdish")
  88. ("ky" . "Kirghiz")
  89. ("la" . "Latin")
  90. ("ln" . "Lingala")
  91. ("lo" . "Laothian")
  92. ("lt" . "Lithuanian")
  93. ("lv" . "Latvian, Lettish")
  94. ("mg" . "Malagasy")
  95. ("mi" . "Maori")
  96. ("mk" . "Macedonian")
  97. ("ml" . "Malayalam")
  98. ("mn" . "Mongolian")
  99. ("mo" . "Moldavian")
  100. ("mr" . "Marathi")
  101. ("ms" . "Malay")
  102. ("mt" . "Maltese")
  103. ("my" . "Burmese")
  104. ("na" . "Nauru")
  105. ("ne" . "Nepali")
  106. ("nl" . "Dutch")
  107. ("no" . "Norwegian")
  108. ("oc" . "Occitan")
  109. ("om" . "(Afan) Oromo")
  110. ("or" . "Oriya")
  111. ("pa" . "Punjabi")
  112. ("pl" . "Polish")
  113. ("ps" . "Pashto, Pushto")
  114. ("pt" . "Portuguese")
  115. ("qu" . "Quechua")
  116. ("rm" . "Rhaeto-Romance")
  117. ("rn" . "Kirundi")
  118. ("ro" . "Romanian")
  119. ("ru" . "Russian")
  120. ("rw" . "Kinyarwanda")
  121. ("sa" . "Sanskrit")
  122. ("sd" . "Sindhi")
  123. ("sg" . "Sangho")
  124. ("sh" . "Serbo-Croatian")
  125. ("si" . "Sinhalese")
  126. ("sk" . "Slovak")
  127. ("sl" . "Slovenian")
  128. ("sm" . "Samoan")
  129. ("sn" . "Shona")
  130. ("so" . "Somali")
  131. ("sq" . "Albanian")
  132. ("sr" . "Serbian")
  133. ("ss" . "Siswati")
  134. ("st" . "Sesotho")
  135. ("su" . "Sundanese")
  136. ("sv" . "Swedish")
  137. ("sw" . "Swahili")
  138. ("ta" . "Tamil")
  139. ("te" . "Telugu")
  140. ("tg" . "Tajik")
  141. ("th" . "Thai")
  142. ("ti" . "Tigrinya")
  143. ("tk" . "Turkmen")
  144. ("tl" . "Tagalog")
  145. ("tn" . "Setswana")
  146. ("to" . "Tonga")
  147. ("tr" . "Turkish")
  148. ("ts" . "Tsonga")
  149. ("tt" . "Tatar")
  150. ("tw" . "Twi")
  151. ("ug" . "Uighur")
  152. ("uk" . "Ukrainian")
  153. ("ur" . "Urdu")
  154. ("uz" . "Uzbek")
  155. ("vi" . "Vietnamese")
  156. ("vo" . "Volapuk")
  157. ("wo" . "Wolof")
  158. ("xh" . "Xhosa")
  159. ("yi" . "Yiddish (formerly ji)")
  160. ("yo" . "Yoruba")
  161. ("za" . "Zhuang")
  162. ("zh" . "Chinese")
  163. ("zu" . "Zulu"))
  164. "Alist of ISO language codes and language names.
  165. This is based on the technical contents of ISO 639:1988 (E/F)
  166. \"Code for the representation of names of languages\".
  167. Typed by Keld.Simonsen@dkuug.dk 1990-11-30
  168. <ftp://dkuug.dk/i18n/ISO_639>
  169. Minor corrections, 1992-09-08 by Keld Simonsen
  170. Sundanese corrected, 1992-11-11 by Keld Simonsen
  171. Telugu corrected, 1995-08-24 by Keld Simonsen
  172. Hebrew, Indonesian, Yiddish corrected 1995-10-10 by Michael Everson
  173. Inuktitut, Uighur, Zhuang added 1995-10-10 by Michael Everson
  174. Sinhalese corrected, 1995-10-10 by Michael Everson
  175. Faeroese corrected to Faroese, 1995-11-18 by Keld Simonsen
  176. Sangro corrected to Sangho, 1996-07-28 by Keld Simonsen
  177. Two-letter lower-case symbols are used.
  178. The Registration Authority for ISO 639 is Infoterm, Osterreichisches
  179. Normungsinstitut (ON), Postfach 130, A-1021 Vienna, Austria.")
  180. (defun language (code)
  181. "Return the language name for the ISO CODE."
  182. (interactive (list (completing-read "ISO language code: "
  183. iso-638-languages)))
  184. (message "%s" (cdr (assoc code iso-638-languages))))
  185. (defun erc-cmd-LANG (language)
  186. "Display the language name for the language code given by LANGUAGE."
  187. (let ((lang (cdr (assoc language iso-638-languages))))
  188. (erc-display-message
  189. nil 'notice 'active
  190. (or lang (concat language ": No such domain"))))
  191. t)
  192. (provide 'erc-lang)
  193. ;;; erc-lang.el ends here