diff --git a/setup/database.sql b/setup/database.sql
index c2fd1be..6f9c306 100644
--- a/setup/database.sql
+++ b/setup/database.sql
@@ -149,13 +149,6 @@ CREATE TABLE contacts (
lastupdate DATETIME
);
-# An auxiliary table mapping country codes to country names.
-CREATE TABLE refcountry (
- code CHAR(2) NOT NULL PRIMARY KEY,
- name VARCHAR(255) NOT NULL,
- INDEX name_x (name)
-);
-
# A table listing email addresses which are barred from registering.
CREATE TABLE emailban (
address VARCHAR(255) NOT NULL PRIMARY KEY,
@@ -194,13 +187,6 @@ CREATE TABLE sigs (
INDEX list_alpha (catid, signame)
);
-# An auxiliary table mapping language codes to names.
-CREATE TABLE reflanguage (
- code VARCHAR(20) NOT NULL PRIMARY KEY,
- name VARCHAR(255) NOT NULL,
- INDEX name_x (name)
-);
-
# The table mapping category IDs to category names.
CREATE TABLE refcategory (
catid INT NOT NULL PRIMARY KEY,
@@ -515,480 +501,6 @@ INSERT INTO refaudit (type, descr) VALUES
(315, 'Delete Conference'),
(9999999, 'DUMMY');
-# The ISO 3166 two-letter country codes. Source is
-# .
-INSERT INTO refcountry (code, name) VALUES
- ('AF', 'Afghanistan'),
- ('AL', 'Albania'),
- ('DZ', 'Algeria'),
- ('AS', 'American Samoa'),
- ('AD', 'Andorra'),
- ('AO', 'Angola'),
- ('AI', 'Anguilla'),
- ('AQ', 'Antarctica'),
- ('AG', 'Antigua and Barbuda'),
- ('AR', 'Argentina'),
- ('AM', 'Armenia'),
- ('AW', 'Aruba'),
- ('AU', 'Australia'),
- ('AT', 'Austria'),
- ('AZ', 'Azerbaijan'),
- ('BS', 'Bahamas'),
- ('BH', 'Bahrain'),
- ('BD', 'Bangladesh'),
- ('BB', 'Barbados'),
- ('BY', 'Belarus'),
- ('BE', 'Belgium'),
- ('BZ', 'Belize'),
- ('BJ', 'Benin'),
- ('BM', 'Bermuda'),
- ('BT', 'Bhutan'),
- ('BO', 'Bolivia'),
- ('BA', 'Bosnia and Herzegovina'),
- ('BW', 'Botswana'),
- ('BV', 'Bouvet Island'),
- ('BR', 'Brazil'),
- ('IO', 'British Indian Ocean Territory'),
- ('BN', 'Brunei Darussalam'),
- ('BG', 'Bulgaria'),
- ('BF', 'Burkina Faso'),
- ('BI', 'Burundi'),
- ('KH', 'Cambodia'),
- ('CM', 'Cameroon'),
- ('CA', 'Canada'),
- ('CV', 'Cape Verde'),
- ('KY', 'Cayman Islands'),
- ('CF', 'Central African Republic'),
- ('TD', 'Chad'),
- ('CL', 'Chile'),
- ('CN', 'China'),
- ('CX', 'Chrismas Island'),
- ('CC', 'Cocos (Keeling) Islands'),
- ('CO', 'Colombia'),
- ('KM', 'Comoros'),
- ('CG', 'Congo'),
- ('CD', 'Congo (Democratic Republic of)'),
- ('CK', 'Cook Islands'),
- ('CR', 'Costa Rica'),
- ('CI', 'Cote D''Ivoire'),
- ('HR', 'Croatia'),
- ('CU', 'Cuba'),
- ('CY', 'Cyprus'),
- ('CZ', 'Czech Republic'),
- ('DK', 'Denmark'),
- ('DJ', 'Djibouti'),
- ('DM', 'Dominica'),
- ('DO', 'Dominican Republic'),
- ('TP', 'East Timor'),
- ('EC', 'Ecuador'),
- ('EG', 'Egypt'),
- ('SV', 'El Salvador'),
- ('GQ', 'Equatorial Guinea'),
- ('ER', 'Eritrea'),
- ('EE', 'Estonia'),
- ('ET', 'Ethiopia'),
- ('FK', 'Falkland Islands (Malvinas)'),
- ('FO', 'Faroe Islands'),
- ('FJ', 'Fiji'),
- ('FI', 'Finland'),
- ('FR', 'France'),
- ('GF', 'French Guiana'),
- ('PF', 'French Polynesia'),
- ('TF', 'French Southern Territories'),
- ('GA', 'Gabon'),
- ('GM', 'Gambia'),
- ('GE', 'Georgia'),
- ('DE', 'Germany'),
- ('GH', 'Ghana'),
- ('GI', 'Gibraltar'),
- ('GR', 'Greece'),
- ('GL', 'Greenland'),
- ('GD', 'Grenada'),
- ('GP', 'Guadeloupe'),
- ('GU', 'Guam'),
- ('GT', 'Guatemala'),
- ('GN', 'Guinea'),
- ('GW', 'Guinea-Bissau'),
- ('GY', 'Guyana'),
- ('HT', 'Haiti'),
- ('HM', 'Heard Island and McDonald Islands'),
- ('VA', 'Holy See (Vatican City State)'),
- ('HN', 'Honduras'),
- ('HK', 'Hong Kong'),
- ('HU', 'Hungary'),
- ('IS', 'Iceland'),
- ('IN', 'India'),
- ('ID', 'Indonesia'),
- ('IR', 'Iran (Islamic Republic of)'),
- ('IQ', 'Iraq'),
- ('IE', 'Ireland'),
- ('IL', 'Israel'),
- ('IT', 'Italy'),
- ('JM', 'Jamaica'),
- ('JP', 'Japan'),
- ('JO', 'Jordan'),
- ('KZ', 'Kazakhstan'),
- ('KE', 'Kenya'),
- ('KI', 'Kiribati'),
- ('KP', 'Korea (Democratic People''s Republic of)'),
- ('KO', 'Korea (Republic of)'),
- ('KW', 'Kuwait'),
- ('KG', 'Kyrgyzstan'),
- ('LA', 'Lao People''s Democratic Republic'),
- ('LV', 'Latvia'),
- ('LB', 'Lebanon'),
- ('LS', 'Lesotho'),
- ('LR', 'Liberia'),
- ('LY', 'Libyan Arab Jamahirya'),
- ('LI', 'Liechtenstein'),
- ('LT', 'Lithuania'),
- ('LU', 'Luxembourg'),
- ('MO', 'Macau'),
- ('MK', 'Macedonia (Former Yugoslav Republic of)'),
- ('MG', 'Madagascar'),
- ('MW', 'Malawi'),
- ('MY', 'Malaysia'),
- ('MV', 'Maldives'),
- ('ML', 'Mali'),
- ('MT', 'Malta'),
- ('MH', 'Marshall Islands'),
- ('MQ', 'Martinique'),
- ('MR', 'Mauritania'),
- ('MU', 'Mauritius'),
- ('YT', 'Mayotte'),
- ('MX', 'Mexico'),
- ('FM', 'Micronesia (Federated States of)'),
- ('MD', 'Moldova, Republic of'),
- ('MC', 'Monaco'),
- ('MN', 'Mongolia'),
- ('MS', 'Montserrat'),
- ('MA', 'Morocco'),
- ('MZ', 'Mozambique'),
- ('MM', 'Myanmar'),
- ('NA', 'Namibia'),
- ('NR', 'Nauru'),
- ('NP', 'Nepal'),
- ('NL', 'Netherlands'),
- ('AN', 'Netherlands Antillies'),
- ('NC', 'New Caledonia'),
- ('NZ', 'New Zealand'),
- ('NI', 'Nicaragua'),
- ('NE', 'Niger'),
- ('NG', 'Nigeria'),
- ('NU', 'Niue'),
- ('NF', 'Norfolk Island'),
- ('MP', 'Northern Mariana Islands'),
- ('NO', 'Norway'),
- ('OM', 'Oman'),
- ('PK', 'Pakistan'),
- ('PW', 'Palau'),
- ('PS', 'Palestinian Territory, Occupied'),
- ('PA', 'Panama'),
- ('PG', 'Papua New Guinea'),
- ('PY', 'Paraguay'),
- ('PE', 'Peru'),
- ('PH', 'Phillipines'),
- ('PN', 'Pitcairn'),
- ('PL', 'Poland'),
- ('PT', 'Portugal'),
- ('PR', 'Puerto Rico'),
- ('QA', 'Qatar'),
- ('RE', 'Reunion'),
- ('RO', 'Romania'),
- ('RU', 'Russian Federation'),
- ('RW', 'Rwanda'),
- ('SH', 'Saint Helena'),
- ('KN', 'Saint Kitts and Nevis'),
- ('LC', 'Saint Lucia'),
- ('PM', 'Saint Pierre and Miquelon'),
- ('VC', 'Saint Vincent and The Grenadines'),
- ('WS', 'Samoa'),
- ('SM', 'San Marino'),
- ('ST', 'Sao Tome and Principe'),
- ('SA', 'Saudi Arabia'),
- ('SN', 'Senegal'),
- ('SC', 'Seychelles'),
- ('SL', 'Sierra Leone'),
- ('SG', 'Singapore'),
- ('SK', 'Slovakia'),
- ('SI', 'Slovenia'),
- ('SB', 'Solomon Islands'),
- ('SO', 'Somalia'),
- ('ZA', 'South Africa'),
- ('GS', 'South Georgia and the South Sandwich Islands'),
- ('ES', 'Spain'),
- ('LK', 'Sri Lanka'),
- ('SD', 'Sudan'),
- ('SR', 'Suriname'),
- ('SJ', 'Svalbard and Jan Mayen'),
- ('SZ', 'Swaziland'),
- ('SE', 'Sweden'),
- ('CH', 'Switzerland'),
- ('SY', 'Syrian Arab Republic'),
- ('TW', 'Taiwan (Province of China)'),
- ('TJ', 'Tajikistan'),
- ('TZ', 'Tanzania, United Republic of'),
- ('TH', 'Thailand'),
- ('TG', 'Togo'),
- ('TK', 'Tokelau'),
- ('TO', 'Tonga'),
- ('TT', 'Trinidad and Tobago'),
- ('TN', 'Tunisia'),
- ('TR', 'Turkey'),
- ('TM', 'Turkmenistan'),
- ('TC', 'Turks and Caicos Islands'),
- ('TV', 'Tuvalu'),
- ('UG', 'Uganda'),
- ('UA', 'Ukraine'),
- ('AE', 'United Arab Emirates'),
- ('GB', 'United Kingdom'),
- ('US', 'United States'),
- ('UM', 'United States Minor Outlying Islands'),
- ('UY', 'Uruguay'),
- ('UZ', 'Uzbekistan'),
- ('VU', 'Vanatu'),
- ('VE', 'Venezuela'),
- ('VN', 'Viet Nam'),
- ('VG', 'Virgin Islands (British)'),
- ('VI', 'Virgin Islands (U.S.)'),
- ('WF', 'Wallis and Futuna'),
- ('EH', 'Western Sahara'),
- ('YE', 'Yemen'),
- ('YU', 'Yugoslavia'),
- ('ZM', 'Zambia'),
- ('ZW', 'Zimbabwe'),
- ('XX', '(unknown)');
-
-# The RFC1766 language codes, based on ISO 639 and 3166. Sources:
-# ISO 639 from , 3166 as above,
-# language variants by country from Windows WINNT.H header file; additional
-# language codes (expanded zh- and i- names) from IANA,
-# ; changes to Indonesian,
-# Hebrew, and Yiddish noted from Java 2 SDK documentation
-INSERT INTO reflanguage (code, name) VALUES
- ('aa', 'Afar'),
- ('ab', 'Abkhazian'),
- ('af', 'Afrikaans'),
- ('am', 'Amharic'),
- ('ar', 'Arabic'),
- ('ar-SA', 'Arabic (Saudi Arabia)'),
- ('ar-IQ', 'Arabic (Iraq)'),
- ('ar-EG', 'Arabic (Egypt)'),
- ('ar-LY', 'Arabic (Libya)'),
- ('ar-DZ', 'Arabic (Algeria)'),
- ('ar-MA', 'Arabic (Morocco)'),
- ('ar-TN', 'Arabic (Tunisia)'),
- ('ar-OM', 'Arabic (Oman)'),
- ('ar-YE', 'Arabic (Yemen)'),
- ('ar-SY', 'Arabic (Syria)'),
- ('ar-JO', 'Arabic (Jordan)'),
- ('ar-LB', 'Arabic (Lebanon)'),
- ('ar-KW', 'Arabic (Kuwait)'),
- ('ar-AE', 'Arabic (U.A.E.)'),
- ('ar-BH', 'Arabic (Bahrain)'),
- ('ar-QA', 'Arabic (Qatar)'),
- ('as', 'Assamese'),
- ('ay', 'Aymara'),
- ('az', 'Azerbaijani'),
- ('ba', 'Bashkir'),
- ('be', 'Byelorussian'),
- ('bg', 'Bulgarian'),
- ('bh', 'Bihari'),
- ('bi', 'Bislama'),
- ('bn', 'Bengali'),
- ('bo', 'Tibetan'),
- ('br', 'Breton'),
- ('ca', 'Catalan'),
- ('co', 'Corsican'),
- ('cs', 'Czech'),
- ('cy', 'Welsh'),
- ('da', 'Danish'),
- ('de', 'German'),
- ('de-CH', 'German (Swiss)'),
- ('de-AT', 'German (Austria)'),
- ('de-LU', 'German (Luxembourg)'),
- ('de-LI', 'German (Liechtenstein)'),
- ('dz', 'Bhutani'),
- ('el', 'Greek'),
- ('en', 'English'),
- ('en-US', 'English (United States)'),
- ('en-GB', 'English (United Kingdom)'),
- ('en-AU', 'English (Australian)'),
- ('en-CA', 'English (Canadian)'),
- ('en-NZ', 'English (New Zealand)'),
- ('en-IE', 'English (Irish)'),
- ('en-ZA', 'English (South Africa)'),
- ('en-JM', 'English (Jamaica)'),
- ('en-caribbean', 'English (Caribbean)'),
- ('en-BZ', 'English (Belize)'),
- ('en-TT', 'English (Trinidad)'),
- ('en-scouse', 'English (Scouse)'),
- ('eo', 'Esperanto'),
- ('es', 'Spanish (Modern)'),
- ('es-ES', 'Spanish (Castilian)'),
- ('es-MX', 'Spanish (Mexican)'),
- ('es-GT', 'Spanish (Guatemala)'),
- ('es-CR', 'Spanish (Costa Rica)'),
- ('es-PA', 'Spanish (Panama)'),
- ('es-DO', 'Spanish (Dominican Republic)'),
- ('es-VE', 'Spanish (Venezuela)'),
- ('es-CO', 'Spanish (Colombia)'),
- ('es-PE', 'Spanish (Peru)'),
- ('es-AR', 'Spanish (Argentina)'),
- ('es-EC', 'Spanish (Ecuador)'),
- ('es-CL', 'Spanish (Chile)'),
- ('es-UY', 'Spanish (Uruguay)'),
- ('es-PY', 'Spanish (Paraguay)'),
- ('es-BO', 'Spanish (Bolivia)'),
- ('es-SV', 'Spanish (El Salvador)'),
- ('es-HN', 'Spanish (Honduras)'),
- ('es-NI', 'Spanish (Nicaragua)'),
- ('es-PR', 'Spanish (Puerto Rico)'),
- ('et', 'Estonian'),
- ('eu', 'Basque'),
- ('fa', 'Persian'),
- ('fi', 'Finnish'),
- ('fj', 'Fiji'),
- ('fo', 'Faeroese'),
- ('fr', 'French'),
- ('fr-BE', 'French (Belgian)'),
- ('fr-CA', 'French (Canadian)'),
- ('fr-CH', 'French (Swiss)'),
- ('fr-LU', 'French (Luxembourg)'),
- ('fy', 'Frisian'),
- ('ga', 'Irish'),
- ('gd', 'Scots Gaelic'),
- ('gl', 'Galician'),
- ('gn', 'Guarani'),
- ('gu', 'Gujarati'),
- ('ha', 'Hausa'),
- ('hi', 'Hindi'),
- ('hr', 'Croatian'),
- ('hu', 'Hungarian'),
- ('hy', 'Armenian'),
- ('ia', 'Interlingua'),
- ('ie', 'Interlingue'),
- ('ik', 'Inupiak'),
- ('id', 'Indonesian'),
- ('is', 'Icelandic'),
- ('it', 'Italian'),
- ('it-CH', 'Italian (Swiss)'),
- ('he', 'Hebrew'),
- ('ja', 'Japanese'),
- ('yi', 'Yiddish'),
- ('jw', 'Javanese'),
- ('ka', 'Georgian'),
- ('kk', 'Kazakh'),
- ('kl', 'Greenlandic'),
- ('km', 'Cambodian'),
- ('kn', 'Kannada'),
- ('ko', 'Korean'),
- ('ko-johab', 'Korean (Johab)'),
- ('ks', 'Kashmiri'),
- ('ku', 'Kurdish'),
- ('ky', 'Kirghiz'),
- ('la', 'Latin'),
- ('ln', 'Lingala'),
- ('lo', 'Laothian'),
- ('lt', 'Lithuanian'),
- ('lv', 'Latvian'),
- ('mg', 'Malagasi'),
- ('mi', 'Maori'),
- ('mk', 'Macedonian'),
- ('ml', 'Malayalam'),
- ('mn', 'Mongolian'),
- ('mo', 'Moldavian'),
- ('mr', 'Marathi'),
- ('ms', 'Malay'),
- ('mt', 'Maltese'),
- ('my', 'Burmese'),
- ('na', 'Nauru'),
- ('ne', 'Nepali'),
- ('nl', 'Dutch'),
- ('nl-BE', 'Dutch (Belgian)'),
- ('no', 'Norwegian'),
- ('no-bok', 'Norwegian (Bokmal)'),
- ('no-nyn', 'Norwegian (Nynorsk)'),
- ('oc', 'Occitan'),
- ('om', 'Oromo'),
- ('or', 'Oriya'),
- ('pa', 'Punjabi'),
- ('pl', 'Polish'),
- ('ps', 'Pashto'),
- ('pt', 'Portuguese'),
- ('pt-BR', 'Portuguese (Brazilian)'),
- ('qu', 'Quechua'),
- ('rm', 'Rhaeto-Romance'),
- ('rn', 'Kirundi'),
- ('ro', 'Romanian'),
- ('ru', 'Russian'),
- ('rw', 'Kinyarwanda'),
- ('sa', 'Sanskrit'),
- ('sd', 'Sindhi'),
- ('sg', 'Sangro'),
- ('sh', 'Serbo-Croatian'),
- ('si', 'Singhalese'),
- ('sk', 'Slovak'),
- ('sl', 'Slovenian'),
- ('sm', 'Samoan'),
- ('sn', 'Shona'),
- ('so', 'Somali'),
- ('sq', 'Albanian'),
- ('sr', 'Serbian (Latin)'),
- ('sr-cyrillic', 'Serbian (Cyrillic)'),
- ('ss', 'Siswati'),
- ('st', 'Sesotho'),
- ('su', 'Sudanese'),
- ('sv', 'Swedish'),
- ('sv-FI', 'Swedish (Finland)'),
- ('sw', 'Swahili'),
- ('ta', 'Tamil'),
- ('te', 'Tegulu'),
- ('tg', 'Tajik'),
- ('th', 'Thai'),
- ('ti', 'Tigrinya'),
- ('tk', 'Turkmen'),
- ('tl', 'Tagalog'),
- ('tn', 'Setswana'),
- ('to', 'Tonga'),
- ('tr', 'Turkish'),
- ('ts', 'Tsonga'),
- ('tt', 'Tatar'),
- ('tw', 'Twi'),
- ('uk', 'Ukrainian'),
- ('ur', 'Urdu'),
- ('uz', 'Uzbek'),
- ('vi', 'Vietnamese'),
- ('vo', 'Volapuk'),
- ('wo', 'Wolof'),
- ('xh', 'Xhosa'),
- ('yo', 'Yoruba'),
- ('zh', 'Chinese'),
- ('zh-TW', 'Chinese (Traditional)'),
- ('zh-CN', 'Chinese (Simplified)'),
- ('zh-HK', 'Chinese (Hong Kong)'),
- ('zh-SG', 'Chinese (Singapore)'),
- ('zh-gan', 'Chinese (Gan)'),
- ('zh-guoyu', 'Chinese (Mandarin)'),
- ('zh-hakka', 'Chinese (Hakka)'),
- ('zh-min', 'Chinese (Taiwanese)'),
- ('zh-wuu', 'Chinese (Shanghai)'),
- ('zh-xiang', 'Chinese (Hunan)'),
- ('zh-yue', 'Chinese (Cantonese)'),
- ('zu', 'Zulu'),
- ('i-ami', 'Amis'),
- ('i-bnn', 'Bunun'),
- ('i-hak', 'Hakka'),
- ('i-klingon', 'Klingon'),
- ('i-lux', 'Luxembourgish'),
- ('i-mingo', 'Mingo'),
- ('i-navajo', 'Navajo'),
- ('i-pwn', 'Paiwan'),
- ('i-tao', 'Tao'),
- ('i-tay', 'Tayal'),
- ('i-tsu', 'Tsou'),
- ('i-default', '(unknown)');
-
# Populate the Category table.
# Source: Mozilla Open Directory Project categorization system ;
# additional categorization from WebbMe categories
diff --git a/src/com/silverwrist/util/Country.java b/src/com/silverwrist/util/Country.java
new file mode 100644
index 0000000..c77e4af
--- /dev/null
+++ b/src/com/silverwrist/util/Country.java
@@ -0,0 +1,82 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.util;
+
+/**
+ * A utility class used by International
that stores a country code and name pair.
+ *
+ * @author Eric J. Bowersox <erbo@silcom.com>
+ * @version X
+ * @see International
+ */
+public final class Country
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private String code; // the country code
+ private String name; // the country name
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a new Country
object.
+ *
+ * @param code The country code.
+ * @param name The country name.
+ */
+ Country(String code, String name)
+ {
+ this.code = code.trim().toUpperCase();
+ this.name = name.trim();
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * External getters
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the 2-letter country code for this country.
+ *
+ * @return The 2-letter country code for this country.
+ */
+ public final String getCode()
+ {
+ return code;
+
+ } // end code
+
+ /**
+ * Returns the name of this country.
+ *
+ * @return The name of this country.
+ */
+ public final String getName()
+ {
+ return name;
+
+ } // end name
+
+} // end class Country
diff --git a/src/com/silverwrist/util/International.java b/src/com/silverwrist/util/International.java
new file mode 100644
index 0000000..5e9c772
--- /dev/null
+++ b/src/com/silverwrist/util/International.java
@@ -0,0 +1,269 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.util;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * A class which centralizes a number of "international" resources, such as locales,
+ * country lists, and language lists.
+ *
+ * @author Eric J. Bowersox <erbo@silcom.com>
+ * @version X
+ */
+public class International
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ private static International self = new International(); // me
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private List country_list = null; // list of Country objects
+ private Map country_map = null; // mapping from codes to Country objects
+ private List language_list = null; // list of Language objects
+ private Map language_map = null; // mapping from codes to Language objects
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a new instance of the International
object. Only one instance
+ * of this object is ever created.
+ */
+ private International()
+ { // do nothing
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal operations
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Loads the internal list of countries from a resource file.
+ *
+ * @exception RuntimeException If an I/O error occurred while loading the country list.
+ */
+ private synchronized void loadCountryList()
+ {
+ if ((country_list!=null) || (country_map!=null))
+ return; // already loaded
+
+ // Create temporary list and map to hold read data.
+ ArrayList tmp_list = new ArrayList();
+ HashMap tmp_map = new HashMap();
+
+ try
+ { // Load the country properties file.
+ BufferedReader data =
+ new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("countries.properties")));
+ String l; // temporary line
+ while ((l = data.readLine())!=null)
+ { // read lines from the properties file
+ l = l.trim();
+ if ((l.length()==0) || (l.startsWith("#")))
+ continue; // blank line or comment line
+ int pos = l.indexOf('=');
+ if (pos<0)
+ continue; // no properties - just forget this line
+ Country c = new Country(l.substring(0,pos),l.substring(pos+1));
+ tmp_list.add(c);
+ tmp_map.put(c.getCode(),c);
+
+ } // end while
+
+ } // end try
+ catch (IOException e)
+ { // IO error loading country properties...
+ throw new RuntimeException("Error loading country.properties: " + e.getMessage());
+
+ } // end catch
+
+ // Set up the lists, which are considered "unmodifiable."
+ tmp_list.trimToSize();
+ country_list = Collections.unmodifiableList(tmp_list);
+ country_map = Collections.unmodifiableMap(tmp_map);
+
+ } // end loadCountryList
+
+ /**
+ * Loads the internal list of languages from a resource file.
+ *
+ * @exception RuntimeException If an I/O error occurred while loading the language list.
+ */
+ private synchronized void loadLanguageList()
+ {
+ if ((language_list!=null) || (language_map!=null))
+ return; // already loaded
+
+ // Create temporary list and map to hold read data.
+ ArrayList tmp_list = new ArrayList();
+ HashMap tmp_map = new HashMap();
+
+ try
+ { // Load the language properties file.
+ BufferedReader data =
+ new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("languages.properties")));
+ String l; // temporary line
+ while ((l = data.readLine())!=null)
+ { // read lines from the properties file
+ l = l.trim();
+ if ((l.length()==0) || (l.startsWith("#")))
+ continue; // blank line or comment line
+ int pos = l.indexOf('=');
+ if (pos<0)
+ continue; // no properties - just forget this line
+ Language lng = new Language(l.substring(0,pos),l.substring(pos+1));
+ tmp_list.add(lng);
+ tmp_map.put(lng.getCode(),lng);
+
+ } // end while
+
+ } // end try
+ catch (IOException e)
+ { // IO error loading language properties...
+ throw new RuntimeException("Error loading language.properties: " + e.getMessage());
+
+ } // end catch
+
+ // Set up the lists, which are considered "unmodifiable."
+ tmp_list.trimToSize();
+ language_list = Collections.unmodifiableList(tmp_list);
+ language_map = Collections.unmodifiableMap(tmp_map);
+
+ } // end loadLanguageList
+
+ /*--------------------------------------------------------------------------------
+ * External operations
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the list of defined countries.
+ *
+ * @return The list of Country
objects that are currently defined.
+ */
+ public List getCountryList()
+ {
+ loadCountryList();
+ return country_list;
+
+ } // end getCountryList
+
+ /**
+ * Returns the Country
object with the specified code.
+ *
+ * @param code The country code to match.
+ * @return The matching Country
object, or null
if no country matched.
+ */
+ public Country getCountryForCode(String code)
+ {
+ if (code==null)
+ return null;
+ loadCountryList();
+ return (Country)(country_map.get(code.trim().toUpperCase()));
+
+ } // end getCountryForCode
+
+ /**
+ * Returns the list of defined languages.
+ *
+ * @return The list of Language
objects that are currently defined.
+ */
+ public List getLanguageList()
+ {
+ loadLanguageList();
+ return language_list;
+
+ } // end getLanguageList
+
+ /**
+ * Returns the Language
object with the specified code.
+ *
+ * @param code The language code to match.
+ * @return The matching Language
object, or null
if no language matched.
+ */
+ public Language getLanguageForCode(String code)
+ {
+ if (code==null)
+ return null;
+ loadLanguageList();
+ return (Language)(language_map.get(code.trim()));
+
+ } // end getLanguageForCode
+
+ /**
+ * Creates a Locale
from a standard descriptor string.
+ *
+ * @param streq The string equivalent of the Locale to be created.
+ * @return The corresponding Locale
, or the default Locale
if the parameter is
+ * null
or the empty string.
+ */
+ public Locale createLocale(String streq)
+ {
+ if ((streq==null) || (streq.length()==0))
+ return Locale.getDefault(); // no locale
+ int p1 = streq.indexOf('_');
+ if (p1<0)
+ return new Locale(streq,""); // language but no country specified
+ String x_lang = streq.substring(0,p1);
+ int p2 = streq.indexOf('_',p1+1);
+ if (p2<0)
+ { // there's only one underscore - figure out what part the last part is
+ String lastpart = streq.substring(p1+1);
+ if (lastpart.length()==2)
+ return new Locale(x_lang,lastpart); // language + country
+ else
+ return new Locale(x_lang,"",lastpart); // language + country(null) + variant
+
+ } // end if
+
+ // do all three variants
+ return new Locale(x_lang,streq.substring(p1+1,p2),streq.substring(p2+1));
+
+ } // end createLocale
+
+ /*--------------------------------------------------------------------------------
+ * External static operations
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the singleton instance of the International
object.
+ *
+ * @return The singleton instance of the International
object.
+ */
+ public static International get()
+ {
+ return self;
+
+ } // end get()
+
+} // end class International
+
+
diff --git a/src/com/silverwrist/util/Language.java b/src/com/silverwrist/util/Language.java
new file mode 100644
index 0000000..de3a279
--- /dev/null
+++ b/src/com/silverwrist/util/Language.java
@@ -0,0 +1,82 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.util;
+
+/**
+ * A utility class used by International
that stores a language code and name pair.
+ *
+ * @author Eric J. Bowersox <erbo@silcom.com>
+ * @version X
+ * @see International
+ */
+public final class Language
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private String code; // the language code
+ private String name; // the language name
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a new Language
object.
+ *
+ * @param code The language code.
+ * @param name The language name.
+ */
+ Language(String code, String name)
+ {
+ this.code = code.trim();
+ this.name = name.trim();
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * External getters
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the RFC 1766 language code for this language.
+ *
+ * @return The RFC 1766 language code for this language.
+ */
+ public final String getCode()
+ {
+ return code;
+
+ } // end code
+
+ /**
+ * Returns the name of this language.
+ *
+ * @return The name of this language.
+ */
+ public final String getName()
+ {
+ return name;
+
+ } // end name
+
+} // end class Language
diff --git a/src/com/silverwrist/util/LocaleFactory.java b/src/com/silverwrist/util/LocaleFactory.java
deleted file mode 100644
index 9cec309..0000000
--- a/src/com/silverwrist/util/LocaleFactory.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at .
- *
- * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
- * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
- * language governing rights and limitations under the License.
- *
- * The Original Code is the Venice Web Communities System.
- *
- * The Initial Developer of the Original Code is Eric J. Bowersox ,
- * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
- * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
- *
- * Contributor(s):
- */
-package com.silverwrist.util;
-
-import java.util.*;
-
-/**
- * A utility class which creates Locale
objects from standard descriptor strings.
- * The descriptor strings are of the form returned by Locale.toString()
.
- *
- * @author Eric J. Bowersox <erbo@silcom.com>
- * @version X
- * @see java.util.Locale
- * @see java.util.Locale#toString()
- */
-public class LocaleFactory
-{
- /*--------------------------------------------------------------------------------
- * Constructor
- *--------------------------------------------------------------------------------
- */
-
- private LocaleFactory()
- { // this object cannot be instantiated
- } // end constructor
-
- /*--------------------------------------------------------------------------------
- * External static operations
- *--------------------------------------------------------------------------------
- */
-
- /**
- * Creates a Locale
from a standard descriptor string.
- *
- * @param streq The string equivalent of the Locale to be created.
- * @return The corresponding Locale
, or the default Locale
if the parameter is
- * null
or the empty string.
- */
- public static Locale createLocale(String streq)
- {
- if ((streq==null) || (streq.length()==0))
- return Locale.getDefault(); // no locale
- int p1 = streq.indexOf('_');
- if (p1<0)
- return new Locale(streq,""); // language but no country specified
- String x_lang = streq.substring(0,p1);
- int p2 = streq.indexOf('_',p1+1);
- if (p2<0)
- { // there's only one underscore - figure out what part the last part is
- String lastpart = streq.substring(p1+1);
- if (lastpart.length()==2)
- return new Locale(x_lang,lastpart); // language + country
- else
- return new Locale(x_lang,"",lastpart); // language + country(null) + variant
-
- } // end if
-
- // do all three variants
- return new Locale(x_lang,streq.substring(p1+1,p2),streq.substring(p2+1));
-
- } // end createLocale
-
-} // end class LocaleFactory
diff --git a/src/com/silverwrist/util/countries.properties b/src/com/silverwrist/util/countries.properties
new file mode 100644
index 0000000..4b16c4e
--- /dev/null
+++ b/src/com/silverwrist/util/countries.properties
@@ -0,0 +1,261 @@
+# The contents of this file are subject to the Mozilla Public License Version 1.1
+# (the "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at .
+#
+# Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+# WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+# language governing rights and limitations under the License.
+#
+# The Original Code is the Venice Web Communities System.
+#
+# The Initial Developer of the Original Code is Eric J. Bowersox ,
+# for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+# Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+#
+# Contributor(s):
+# -------------------------------------------------------------------------------------
+# This list of countries is taken from the ISO 3166 standard list of country names and
+# 2-letter codes . When adding new
+# entries to this file, make sure and add it in sorted order by country NAME! You can
+# re-sort the country entries with "sort -t = -k 2 input > output", but then make sure
+# the "XX=(unknown)" entry appears first!
+XX=(unknown)
+AF=Afghanistan
+AL=Albania
+DZ=Algeria
+AS=American Samoa
+AD=Andorra
+AO=Angola
+AI=Anguilla
+AQ=Antarctica
+AG=Antigua and Barbuda
+AR=Argentina
+AM=Armenia
+AW=Aruba
+AU=Australia
+AT=Austria
+AZ=Azerbaijan
+BS=Bahamas
+BH=Bahrain
+BD=Bangladesh
+BB=Barbados
+BY=Belarus
+BE=Belgium
+BZ=Belize
+BJ=Benin
+BM=Bermuda
+BT=Bhutan
+BO=Bolivia
+BA=Bosnia and Herzegovina
+BW=Botswana
+BV=Bouvet Island
+BR=Brazil
+IO=British Indian Ocean Territory
+BN=Brunei Darussalam
+BG=Bulgaria
+BF=Burkina Faso
+BI=Burundi
+KH=Cambodia
+CM=Cameroon
+CA=Canada
+CV=Cape Verde
+KY=Cayman Islands
+CF=Central African Republic
+TD=Chad
+CL=Chile
+CN=China
+CX=Chrismas Island
+CC=Cocos (Keeling) Islands
+CO=Colombia
+KM=Comoros
+CG=Congo
+CD=Congo (Democratic Republic of)
+CK=Cook Islands
+CR=Costa Rica
+CI=Cote D''Ivoire
+HR=Croatia
+CU=Cuba
+CY=Cyprus
+CZ=Czech Republic
+DK=Denmark
+DJ=Djibouti
+DM=Dominica
+DO=Dominican Republic
+TP=East Timor
+EC=Ecuador
+EG=Egypt
+SV=El Salvador
+GQ=Equatorial Guinea
+ER=Eritrea
+EE=Estonia
+ET=Ethiopia
+FK=Falkland Islands (Malvinas)
+FO=Faroe Islands
+FJ=Fiji
+FI=Finland
+FR=France
+GF=French Guiana
+PF=French Polynesia
+TF=French Southern Territories
+GA=Gabon
+GM=Gambia
+GE=Georgia
+DE=Germany
+GH=Ghana
+GI=Gibraltar
+GR=Greece
+GL=Greenland
+GD=Grenada
+GP=Guadeloupe
+GU=Guam
+GT=Guatemala
+GN=Guinea
+GW=Guinea-Bissau
+GY=Guyana
+HT=Haiti
+HM=Heard Island and McDonald Islands
+VA=Holy See (Vatican City State)
+HN=Honduras
+HK=Hong Kong
+HU=Hungary
+IS=Iceland
+IN=India
+ID=Indonesia
+IR=Iran (Islamic Republic of)
+IQ=Iraq
+IE=Ireland
+IL=Israel
+IT=Italy
+JM=Jamaica
+JP=Japan
+JO=Jordan
+KZ=Kazakhstan
+KE=Kenya
+KI=Kiribati
+KP=Korea (Democratic People's Republic of)
+KO=Korea (Republic of)
+KW=Kuwait
+KG=Kyrgyzstan
+LA=Lao People's Democratic Republic
+LV=Latvia
+LB=Lebanon
+LS=Lesotho
+LR=Liberia
+LY=Libyan Arab Jamahirya
+LI=Liechtenstein
+LT=Lithuania
+LU=Luxembourg
+MO=Macau
+MK=Macedonia (Former Yugoslav Republic of)
+MG=Madagascar
+MW=Malawi
+MY=Malaysia
+MV=Maldives
+ML=Mali
+MT=Malta
+MH=Marshall Islands
+MQ=Martinique
+MR=Mauritania
+MU=Mauritius
+YT=Mayotte
+MX=Mexico
+FM=Micronesia (Federated States of)
+MD=Moldova, Republic of
+MC=Monaco
+MN=Mongolia
+MS=Montserrat
+MA=Morocco
+MZ=Mozambique
+MM=Myanmar
+NA=Namibia
+NR=Nauru
+NP=Nepal
+NL=Netherlands
+AN=Netherlands Antillies
+NC=New Caledonia
+NZ=New Zealand
+NI=Nicaragua
+NE=Niger
+NG=Nigeria
+NU=Niue
+NF=Norfolk Island
+MP=Northern Mariana Islands'),
+NO=Norway
+OM=Oman
+PK=Pakistan
+PW=Palau
+PS=Palestinian Territory, Occupied
+PA=Panama
+PG=Papua New Guinea
+PY=Paraguay
+PE=Peru
+PH=Phillipines
+PN=Pitcairn
+PL=Poland
+PT=Portugal
+PR=Puerto Rico
+QA=Qatar
+RE=Reunion
+RO=Romania
+RU=Russian Federation
+RW=Rwanda
+SH=Saint Helena
+KN=Saint Kitts and Nevis
+LC=Saint Lucia
+PM=Saint Pierre and Miquelon
+VC=Saint Vincent and The Grenadines
+WS=Samoa
+SM=San Marino
+ST=Sao Tome and Principe
+SA=Saudi Arabia
+SN=Senegal
+SC=Seychelles
+SL=Sierra Leone
+SG=Singapore
+SK=Slovakia
+SI=Slovenia
+SB=Solomon Islands
+SO=Somalia
+ZA=South Africa
+GS=South Georgia and the South Sandwich Islands
+ES=Spain
+LK=Sri Lanka
+SD=Sudan
+SR=Suriname
+SJ=Svalbard and Jan Mayen
+SZ=Swaziland
+SE=Sweden
+CH=Switzerland
+SY=Syrian Arab Republic
+TW=Taiwan (Province of China)
+TJ=Tajikistan
+TZ=Tanzania, United Republic of
+TH=Thailand
+TG=Togo
+TK=Tokelau
+TO=Tonga
+TT=Trinidad and Tobago
+TN=Tunisia
+TR=Turkey
+TM=Turkmenistan
+TC=Turks and Caicos Islands
+TV=Tuvalu
+UG=Uganda
+UA=Ukraine
+AE=United Arab Emirates
+GB=United Kingdom
+US=United States
+UM=United States Minor Outlying Islands
+UY=Uruguay
+UZ=Uzbekistan
+VU=Vanatu
+VE=Venezuela
+VN=Viet Nam
+VG=Virgin Islands (British)
+VI=Virgin Islands (U.S.)
+WF=Wallis and Futuna
+EH=Western Sahara
+YE=Yemen
+YU=Yugoslavia
+ZM=Zambia
+ZW=Zimbabwe
diff --git a/src/com/silverwrist/util/languages.properties b/src/com/silverwrist/util/languages.properties
new file mode 100644
index 0000000..bea20c0
--- /dev/null
+++ b/src/com/silverwrist/util/languages.properties
@@ -0,0 +1,247 @@
+# The contents of this file are subject to the Mozilla Public License Version 1.1
+# (the "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at .
+#
+# Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+# WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+# language governing rights and limitations under the License.
+#
+# The Original Code is the Venice Web Communities System.
+#
+# The Initial Developer of the Original Code is Eric J. Bowersox ,
+# for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+# Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+#
+# Contributor(s):
+# -------------------------------------------------------------------------------------
+# This list of languages is styled on RFC 1766, based on ISO 639 language code listings,
+# from , and ISO 3166 country code listings,
+# from . Language variants by country taken
+# from WINNT.H header file, Microsoft Windows Platform SDK. Additional language codes
+# (i- names and expanded zh- names) from IANA, .
+# Changes to Indonesian, Hebrew, and Yiddish noted from Java 2 SDK documentation.
+# When adding new entries to this file, make sure and add it in sorted order by language NAME!
+# You can re-sort the language entries with "sort -t = -k 2 input > output", but then make sure
+# the "i-default=(unknown)" entry appears first!
+i-default=(unknown)
+ab=Abkhazian
+aa=Afar
+af=Afrikaans
+sq=Albanian
+am=Amharic
+i-ami=Amis
+ar=Arabic
+ar-DZ=Arabic (Algeria)
+ar-BH=Arabic (Bahrain)
+ar-EG=Arabic (Egypt)
+ar-IQ=Arabic (Iraq)
+ar-JO=Arabic (Jordan)
+ar-KW=Arabic (Kuwait)
+ar-LB=Arabic (Lebanon)
+ar-LY=Arabic (Libya)
+ar-MA=Arabic (Morocco)
+ar-OM=Arabic (Oman)
+ar-QA=Arabic (Qatar)
+ar-SA=Arabic (Saudi Arabia)
+ar-SY=Arabic (Syria)
+ar-TN=Arabic (Tunisia)
+ar-AE=Arabic (U.A.E.)
+ar-YE=Arabic (Yemen)
+hy=Armenian
+as=Assamese
+ay=Aymara
+az=Azerbaijani
+ba=Bashkir
+eu=Basque
+bn=Bengali
+dz=Bhutani
+bh=Bihari
+bi=Bislama
+br=Breton
+bg=Bulgarian
+i-bnn=Bunun
+my=Burmese
+be=Byelorussian
+km=Cambodian
+ca=Catalan
+zh=Chinese
+zh-yue=Chinese (Cantonese)
+zh-gan=Chinese (Gan)
+zh-hakka=Chinese (Hakka)
+zh-HK=Chinese (Hong Kong)
+zh-xiang=Chinese (Hunan)
+zh-guoyu=Chinese (Mandarin)
+zh-wuu=Chinese (Shanghai)
+zh-CN=Chinese (Simplified)
+zh-SG=Chinese (Singapore)
+zh-min=Chinese (Taiwanese)
+zh-TW=Chinese (Traditional)
+co=Corsican
+hr=Croatian
+cs=Czech
+da=Danish
+nl=Dutch
+nl-BE=Dutch (Belgian)
+en=English
+en-AU=English (Australian)
+en-BZ=English (Belize)
+en-CA=English (Canadian)
+en-caribbean=English (Caribbean)
+en-IE=English (Irish)
+en-JM=English (Jamaica)
+en-NZ=English (New Zealand)
+en-scouse=English (Scouse)
+en-ZA=English (South Africa)
+en-TT=English (Trinidad)
+en-GB=English (United Kingdom)
+en-US=English (United States)
+eo=Esperanto
+et=Estonian
+fo=Faeroese
+fj=Fiji
+fi=Finnish
+fr=French
+fr-BE=French (Belgian)
+fr-CA=French (Canadian)
+fr-LU=French (Luxembourg)
+fr-CH=French (Swiss)
+fy=Frisian
+gl=Galician
+ka=Georgian
+de=German
+de-AT=German (Austria)
+de-LI=German (Liechtenstein)
+de-LU=German (Luxembourg)
+de-CH=German (Swiss)
+el=Greek
+kl=Greenlandic
+gn=Guarani
+gu=Gujarati
+i-hak=Hakka
+ha=Hausa
+he=Hebrew
+hi=Hindi
+hu=Hungarian
+is=Icelandic
+id=Indonesian
+ia=Interlingua
+ie=Interlingue
+ik=Inupiak
+ga=Irish
+it=Italian
+it-CH=Italian (Swiss)
+ja=Japanese
+jw=Javanese
+kn=Kannada
+ks=Kashmiri
+kk=Kazakh
+rw=Kinyarwanda
+ky=Kirghiz
+rn=Kirundi
+i-klingon=Klingon
+ko=Korean
+ko-johab=Korean (Johab)
+ku=Kurdish
+lo=Laothian
+la=Latin
+lv=Latvian
+ln=Lingala
+lt=Lithuanian
+i-lux=Luxembourgish
+mk=Macedonian
+mg=Malagasi
+ms=Malay
+ml=Malayalam
+mt=Maltese
+mi=Maori
+mr=Marathi
+i-mingo=Mingo
+mo=Moldavian
+mn=Mongolian
+na=Nauru
+i-navajo=Navajo
+ne=Nepali
+no=Norwegian
+no-bok=Norwegian (Bokmal)
+no-nyn=Norwegian (Nynorsk)
+oc=Occitan
+or=Oriya
+om=Oromo
+i-pwn=Paiwan
+ps=Pashto
+fa=Persian
+pl=Polish
+pt=Portuguese
+pt-BR=Portuguese (Brazilian)
+pa=Punjabi
+qu=Quechua
+rm=Rhaeto-Romance
+ro=Romanian
+ru=Russian
+sm=Samoan
+sg=Sangro
+sa=Sanskrit
+gd=Scots Gaelic
+sr-cyrillic=Serbian (Cyrillic)
+sr=Serbian (Latin)
+sh=Serbo-Croatian
+st=Sesotho
+tn=Setswana
+sn=Shona
+sd=Sindhi
+si=Singhalese
+ss=Siswati
+sk=Slovak
+sl=Slovenian
+so=Somali
+es-AR=Spanish (Argentina)
+es-BO=Spanish (Bolivia)
+es-ES=Spanish (Castilian)
+es-CL=Spanish (Chile)
+es-CO=Spanish (Colombia)
+es-CR=Spanish (Costa Rica)
+es-DO=Spanish (Dominican Republic)
+es-EC=Spanish (Ecuador)
+es-SV=Spanish (El Salvador)
+es-GT=Spanish (Guatemala)
+es-HN=Spanish (Honduras)
+es-MX=Spanish (Mexican)
+es=Spanish (Modern)
+es-NI=Spanish (Nicaragua)
+es-PA=Spanish (Panama)
+es-PY=Spanish (Paraguay)
+es-PE=Spanish (Peru)
+es-PR=Spanish (Puerto Rico)
+es-UY=Spanish (Uruguay)
+es-VE=Spanish (Venezuela)
+su=Sudanese
+sw=Swahili
+sv=Swedish
+sv-FI=Swedish (Finland)
+tl=Tagalog
+tg=Tajik
+ta=Tamil
+i-tao=Tao
+tt=Tatar
+i-tay=Tayal
+te=Tegulu
+th=Thai
+bo=Tibetan
+ti=Tigrinya
+to=Tonga
+ts=Tsonga
+i-tsu=Tsou
+tr=Turkish
+tk=Turkmen
+tw=Twi
+uk=Ukrainian
+ur=Urdu
+uz=Uzbek
+vi=Vietnamese
+vo=Volapuk
+cy=Welsh
+wo=Wolof
+xh=Xhosa
+yi=Yiddish
+yo=Yoruba
+zu=Zulu
diff --git a/src/com/silverwrist/venice/core/Country.java b/src/com/silverwrist/venice/core/Country.java
deleted file mode 100644
index a31ef50..0000000
--- a/src/com/silverwrist/venice/core/Country.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at .
- *
- * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
- * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
- * language governing rights and limitations under the License.
- *
- * The Original Code is the Venice Web Communities System.
- *
- * The Initial Developer of the Original Code is Eric J. Bowersox ,
- * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
- * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
- *
- * Contributor(s):
- */
-package com.silverwrist.venice.core;
-
-public interface Country
-{
- public abstract String getCode();
-
- public abstract String getName();
-
-} // end interface Country
diff --git a/src/com/silverwrist/venice/core/Language.java b/src/com/silverwrist/venice/core/Language.java
deleted file mode 100644
index 833584a..0000000
--- a/src/com/silverwrist/venice/core/Language.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at .
- *
- * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
- * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
- * language governing rights and limitations under the License.
- *
- * The Original Code is the Venice Web Communities System.
- *
- * The Initial Developer of the Original Code is Eric J. Bowersox ,
- * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
- * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
- *
- * Contributor(s):
- */
-package com.silverwrist.venice.core;
-
-public interface Language
-{
- public abstract String getCode();
-
- public abstract String getName();
-
-} // end interface Language
diff --git a/src/com/silverwrist/venice/core/VeniceEngine.java b/src/com/silverwrist/venice/core/VeniceEngine.java
index 3a79e2a..889f9d9 100644
--- a/src/com/silverwrist/venice/core/VeniceEngine.java
+++ b/src/com/silverwrist/venice/core/VeniceEngine.java
@@ -31,12 +31,6 @@ public interface VeniceEngine extends SearchMode
public abstract BitSet getAllFeaturesMask();
- public abstract List getCountryList() throws DataException;
-
- public abstract List getLanguageList() throws DataException;
-
- public abstract String getNameOfCountry(String code);
-
public abstract UserContext createUserContext(String remote_addr) throws DataException;
public abstract String getEmailAddressForUser(String username) throws DataException, AccessError;
diff --git a/src/com/silverwrist/venice/core/impl/AdminUserContextImpl.java b/src/com/silverwrist/venice/core/impl/AdminUserContextImpl.java
index 998e721..a27d4bf 100644
--- a/src/com/silverwrist/venice/core/impl/AdminUserContextImpl.java
+++ b/src/com/silverwrist/venice/core/impl/AdminUserContextImpl.java
@@ -20,7 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
-import com.silverwrist.util.LocaleFactory;
+import com.silverwrist.util.International;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.PasswordHash;
@@ -75,7 +75,7 @@ class AdminUserContextImpl implements AdminUserContext
this.created = SQLUtil.getFullDateTime(rs,"created");
this.last_access = SQLUtil.getFullDateTime(rs,"lastaccess");
this.description = rs.getString("description");
- this.my_locale = LocaleFactory.createLocale(rs.getString("localeid"));
+ this.my_locale = International.get().createLocale(rs.getString("localeid"));
this.my_tz = TimeZone.getTimeZone(rs.getString("tzid"));
} // end constructor
diff --git a/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java b/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java
index d706c21..d1b5744 100644
--- a/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java
+++ b/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java
@@ -20,7 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
-import com.silverwrist.util.StringUtil;
+import com.silverwrist.util.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord;
import com.silverwrist.venice.security.Capability;
@@ -408,7 +408,11 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
{
String code = getLanguageCode();
if (code!=null)
- return engine.getLanguageNameForCode(code);
+ { // translate the language code to a name
+ Language l = International.get().getLanguageForCode(code);
+ return ((l==null) ? null : l.getName());
+
+ } // end if
else
return null;
diff --git a/src/com/silverwrist/venice/core/impl/EngineBackend.java b/src/com/silverwrist/venice/core/impl/EngineBackend.java
index 37724f3..63c9d99 100644
--- a/src/com/silverwrist/venice/core/impl/EngineBackend.java
+++ b/src/com/silverwrist/venice/core/impl/EngineBackend.java
@@ -53,10 +53,6 @@ public interface EngineBackend
public abstract int getNewConfirmationNumber();
- public abstract String getCountryNameForCode(String code);
-
- public abstract String getLanguageNameForCode(String code);
-
public abstract CommunityData getCommunityDataObject(int cid) throws DataException;
public abstract void detachCommunityDataObject(int cid);
diff --git a/src/com/silverwrist/venice/core/impl/UserContextImpl.java b/src/com/silverwrist/venice/core/impl/UserContextImpl.java
index bee72c8..e1eb241 100644
--- a/src/com/silverwrist/venice/core/impl/UserContextImpl.java
+++ b/src/com/silverwrist/venice/core/impl/UserContextImpl.java
@@ -20,9 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.util.*;
import java.sql.*;
import org.apache.log4j.*;
-import com.silverwrist.util.LocaleFactory;
-import com.silverwrist.util.OptionSet;
-import com.silverwrist.util.StringUtil;
+import com.silverwrist.util.*;
import com.silverwrist.venice.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
@@ -144,7 +142,7 @@ class UserContextImpl implements UserContext, UserBackend
my_tz = TimeZone.getTimeZone(rs.getString("tzid"));
if (my_locale==null)
- my_locale = LocaleFactory.createLocale(rs.getString("localeid"));
+ my_locale = International.get().createLocale(rs.getString("localeid"));
// Load the user properties as well.
rs = stmt.executeQuery("SELECT ndx, data FROM propuser WHERE uid = " + uid + ";");
diff --git a/src/com/silverwrist/venice/core/impl/UserProfileImpl.java b/src/com/silverwrist/venice/core/impl/UserProfileImpl.java
index 2309043..b572cb3 100644
--- a/src/com/silverwrist/venice/core/impl/UserProfileImpl.java
+++ b/src/com/silverwrist/venice/core/impl/UserProfileImpl.java
@@ -20,6 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
+import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
@@ -331,7 +332,8 @@ class UserProfileImpl implements UserProfile
public String getFullCountry()
{
- return engine.getCountryNameForCode(country);
+ Country c = International.get().getCountryForCode(country);
+ return ((c==null) ? null : c.getName());
} // end getFullCountry
diff --git a/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java b/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java
index 5f07949..309cdc8 100644
--- a/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java
+++ b/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java
@@ -22,9 +22,7 @@ import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import org.w3c.dom.*;
-import com.silverwrist.util.OptionSet;
-import com.silverwrist.util.StringUtil;
-import com.silverwrist.util.DOMElementHelper;
+import com.silverwrist.util.*;
import com.silverwrist.util.cache.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
@@ -38,68 +36,6 @@ import com.silverwrist.venice.security.DefaultLevels;
public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{
- /*--------------------------------------------------------------------------------
- * Internal class implementing the Country interface
- *--------------------------------------------------------------------------------
- */
-
- static class CountryImpl implements Country
- {
- private String code;
- private String name;
-
- public CountryImpl(String code, String name)
- {
- this.code = code;
- this.name = name;
-
- } // end constructor
-
- public String getCode()
- {
- return code;
-
- } // end getCode
-
- public String getName()
- {
- return name;
-
- } // end getName
-
- } // end class CountryImpl
-
- /*--------------------------------------------------------------------------------
- * Internal class implementing the Language interface
- *--------------------------------------------------------------------------------
- */
-
- static class LanguageImpl implements Language
- {
- private String code;
- private String name;
-
- public LanguageImpl(String code, String name)
- {
- this.code = code;
- this.name = name;
-
- } // end constructor
-
- public String getCode()
- {
- return code;
-
- } // end getCode
-
- public String getName()
- {
- return name;
-
- } // end getName
-
- } // end class LanguageImpl
-
/*--------------------------------------------------------------------------------
* Internal class storing feature information.
*--------------------------------------------------------------------------------
@@ -1066,93 +1002,6 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end getAllFeaturesMask
- public List getCountryList() throws DataException
- {
- checkInitialized();
- Connection conn = null;
- ArrayList rc = new ArrayList();
-
- try
- { // do a SELECT on the refcountry table to load the master country list
- conn = datapool.getConnection();
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery("SELECT code, name FROM refcountry ORDER BY name;");
-
- while (rs.next())
- { // load up a stack of memory objects with the country list
- Country c = new CountryImpl(rs.getString(1),rs.getString(2));
- rc.add(c);
-
- } // end while
-
- if (logger.isDebugEnabled())
- logger.debug("getCountryList(): loaded " + rc.size() + " country names");
-
- } // end try
- catch (SQLException e)
- { // remap to a DataException
- logger.error("DB error loading countries: " + e.getMessage(),e);
- throw new DataException("unable to load country data: " + e.getMessage(),e);
-
- } // end catch
- finally
- { // make sure the connection is released before we go
- if (conn!=null)
- datapool.releaseConnection(conn);
-
- } // end finally
-
- return Collections.unmodifiableList(rc);
-
- } // end getCountryList
-
- public List getLanguageList() throws DataException
- {
- checkInitialized();
- Connection conn = null;
- ArrayList rc = new ArrayList();
-
- try
- { // do a SELECT on the refcountry table to load the master country list
- conn = datapool.getConnection();
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery("SELECT code, name FROM reflanguage ORDER BY name;");
-
- while (rs.next())
- { // load up a stack of memory objects with the country list
- Language l = new LanguageImpl(rs.getString(1),rs.getString(2));
- rc.add(l);
-
- } // end while
-
- if (logger.isDebugEnabled())
- logger.debug("getLanguageList(): loaded " + rc.size() + " language names");
-
- } // end try
- catch (SQLException e)
- { // remap to a DataException
- logger.error("DB error loading languages: " + e.getMessage(),e);
- throw new DataException("unable to load language data: " + e.getMessage(),e);
-
- } // end catch
- finally
- { // make sure the connection is released before we go
- if (conn!=null)
- datapool.releaseConnection(conn);
-
- } // end finally
-
- return Collections.unmodifiableList(rc);
-
- } // end getLanguageList
-
- public String getNameOfCountry(String code)
- {
- checkInitialized();
- return getCountryNameForCode(code);
-
- } // end getNameOfCountry
-
public UserContext createUserContext(String remote_addr) throws DataException
{
checkInitialized();
@@ -2003,92 +1852,6 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end getNewConfirmationNumber
- public String getCountryNameForCode(String code)
- {
- checkInitialized();
- if (code==null)
- return null;
- Connection conn = null;
-
- try
- { // do a SELECT on the refcountry table
- conn = datapool.getConnection();
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery("SELECT name FROM refcountry WHERE code = '" + code + "';");
- if (rs.next())
- { // found it!
- String rc = rs.getString("name");
- if (logger.isDebugEnabled())
- logger.debug("getCountryNameForCode(\"" + code + "\") => \"" + rc + "\"");
- return rc;
-
- } // end if
-
- } // end try
- catch (SQLException e)
- { // force to return null
- logger.warn("DB error looking up country code: " + e.getMessage(),e);
- if (logger.isDebugEnabled())
- logger.debug("getCountryNameForCode(\"" + code + "\") => not found (data error)");
- return null;
-
- } // end catch
- finally
- { // make sure the connection is released before we go
- if (conn!=null)
- datapool.releaseConnection(conn);
-
- } // end finally
-
- if (logger.isDebugEnabled())
- logger.debug("getCountryNameForCode(\"" + code + "\") => not found");
- return null; // if get here, it wasn't found
-
- } // end getCountryNameForCode
-
- public String getLanguageNameForCode(String code)
- {
- checkInitialized();
- if (code==null)
- return null;
- Connection conn = null;
-
- try
- { // do a SELECT on the refcountry table
- conn = datapool.getConnection();
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery("SELECT name FROM reflanguage WHERE CODE = '" + code + "';");
- if (rs.next())
- { // found it!
- String rc = rs.getString("name");
- if (logger.isDebugEnabled())
- logger.debug("getLanguageNameForCode(\"" + code + "\") => \"" + rc + "\"");
- return rc;
-
- } // end if
-
- } // end try
- catch (SQLException e)
- { // force to return null
- logger.warn("DB error looking up language code: " + e.getMessage(),e);
- if (logger.isDebugEnabled())
- logger.debug("getLanguageNameForCode(\"" + code + "\") => not found (data error)");
- return null;
-
- } // end catch
- finally
- { // make sure the connection is released before we go
- if (conn!=null)
- datapool.releaseConnection(conn);
-
- } // end finally
-
- if (logger.isDebugEnabled())
- logger.debug("getLanguageNameForCode(\"" + code + "\") => not found");
- return null; // if get here, it wasn't found
-
- } // end getLanguageNameForCode
-
public CommunityData getCommunityDataObject(int cid) throws DataException
{
checkInitialized();
diff --git a/src/com/silverwrist/venice/servlets/Account.java b/src/com/silverwrist/venice/servlets/Account.java
index b0fedfc..339f3c6 100644
--- a/src/com/silverwrist/venice/servlets/Account.java
+++ b/src/com/silverwrist/venice/servlets/Account.java
@@ -58,7 +58,7 @@ public class Account extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
- NewAccountDialog template = new NewAccountDialog(getCountryList());
+ NewAccountDialog template = new NewAccountDialog();
cache.saveTemplate(template);
} // end if
@@ -109,7 +109,7 @@ public class Account extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
- EditProfileDialog template = new EditProfileDialog(getCountryList());
+ EditProfileDialog template = new EditProfileDialog();
cache.saveTemplate(template);
} // end if
diff --git a/src/com/silverwrist/venice/servlets/CommunityAdmin.java b/src/com/silverwrist/venice/servlets/CommunityAdmin.java
index 0430b34..4ce9bf6 100644
--- a/src/com/silverwrist/venice/servlets/CommunityAdmin.java
+++ b/src/com/silverwrist/venice/servlets/CommunityAdmin.java
@@ -68,7 +68,7 @@ public class CommunityAdmin extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
- EditCommunityProfileDialog template = new EditCommunityProfileDialog(getCountryList(),getLanguageList());
+ EditCommunityProfileDialog template = new EditCommunityProfileDialog();
cache.saveTemplate(template);
} // end if
diff --git a/src/com/silverwrist/venice/servlets/CommunityOperations.java b/src/com/silverwrist/venice/servlets/CommunityOperations.java
index 680e343..82ff6e9 100644
--- a/src/com/silverwrist/venice/servlets/CommunityOperations.java
+++ b/src/com/silverwrist/venice/servlets/CommunityOperations.java
@@ -66,7 +66,7 @@ public class CommunityOperations extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
- CreateCommunityDialog template = new CreateCommunityDialog(getCountryList(),getLanguageList());
+ CreateCommunityDialog template = new CreateCommunityDialog();
cache.saveTemplate(template);
} // end if
diff --git a/src/com/silverwrist/venice/servlets/SystemAdmin.java b/src/com/silverwrist/venice/servlets/SystemAdmin.java
index 71fa9fb..dfc5d94 100644
--- a/src/com/silverwrist/venice/servlets/SystemAdmin.java
+++ b/src/com/silverwrist/venice/servlets/SystemAdmin.java
@@ -65,7 +65,7 @@ public class SystemAdmin extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
- AdminModifyUserDialog template = new AdminModifyUserDialog(getCountryList());
+ AdminModifyUserDialog template = new AdminModifyUserDialog();
cache.saveTemplate(template);
} // end if
diff --git a/src/com/silverwrist/venice/servlets/Variables.java b/src/com/silverwrist/venice/servlets/Variables.java
index 22d1ff5..53f5a12 100644
--- a/src/com/silverwrist/venice/servlets/Variables.java
+++ b/src/com/silverwrist/venice/servlets/Variables.java
@@ -36,8 +36,6 @@ public class Variables
// ServletContext ("application") attributes
protected static final String ENGINE_ATTRIBUTE = "com.silverwrist.venice.core.Engine";
- protected static final String COUNTRYLIST_ATTRIBUTE = "com.silverwrist.venice.db.CountryList";
- protected static final String LANGUAGELIST_ATTRIBUTE = "com.silverwrist.venice.db.LanguageList";
protected static final String STYLESHEET_ATTRIBUTE = "com.silverwrist.venice.rendering.StyleSheet";
// HttpSession ("session") attributes
@@ -168,54 +166,6 @@ public class Variables
} // end clearUserContext
- public static List getCountryList(ServletContext ctxt) throws ServletException
- {
- Object foo = ctxt.getAttribute(COUNTRYLIST_ATTRIBUTE);
- if (foo!=null)
- return (List)foo;
-
- VeniceEngine engine = getVeniceEngine(ctxt);
-
- try
- { // get the country list via the engine and save it
- List rc = engine.getCountryList();
- ctxt.setAttribute(COUNTRYLIST_ATTRIBUTE,rc);
- return rc;
-
- } // end try
- catch (DataException e)
- { // the country list could not be retrieved
- logger.error("Failed to retrieve country list from engine: " + e.getMessage(),e);
- throw new ServletException("Country list retrieval failed: " + e.getMessage(),e);
-
- } // end catch
-
- } // end getCountryList
-
- public static List getLanguageList(ServletContext ctxt) throws ServletException
- {
- Object foo = ctxt.getAttribute(LANGUAGELIST_ATTRIBUTE);
- if (foo!=null)
- return (List)foo;
-
- VeniceEngine engine = getVeniceEngine(ctxt);
-
- try
- { // get the country list via the engine and save it
- List rc = engine.getLanguageList();
- ctxt.setAttribute(LANGUAGELIST_ATTRIBUTE,rc);
- return rc;
-
- } // end try
- catch (DataException e)
- { // the country list could not be retrieved
- logger.error("Failed to retrieve language list from engine: " + e.getMessage(),e);
- throw new ServletException("Language list retrieval failed: " + e.getMessage(),e);
-
- } // end catch
-
- } // end getLanguageList
-
public static ComponentRender getMenu(HttpSession session)
{
return (ComponentRender)(session.getAttribute(MENU_ATTRIBUTE));
diff --git a/src/com/silverwrist/venice/servlets/VeniceServlet.java b/src/com/silverwrist/venice/servlets/VeniceServlet.java
index b570bb5..f911375 100644
--- a/src/com/silverwrist/venice/servlets/VeniceServlet.java
+++ b/src/com/silverwrist/venice/servlets/VeniceServlet.java
@@ -312,30 +312,6 @@ public abstract class VeniceServlet extends HttpServlet
} // end clearUserContext
- protected static final List getCountryList(ServletContext ctxt) throws ServletException
- {
- return Variables.getCountryList(ctxt);
-
- } // end getCountryList
-
- protected final List getCountryList() throws ServletException
- {
- return Variables.getCountryList(getServletContext());
-
- } // end getCountryList
-
- protected final List getLanguageList(ServletContext ctxt) throws ServletException
- {
- return Variables.getLanguageList(ctxt);
-
- } // end getLanguageList
-
- protected final List getLanguageList() throws ServletException
- {
- return Variables.getLanguageList(getServletContext());
-
- } // end getLanguageList
-
protected final void changeMenuTop(HttpServletRequest request)
{
Variables.setMenuTop(getServletContext(),request.getSession(true));
diff --git a/src/com/silverwrist/venice/servlets/format/AdminModifyUserDialog.java b/src/com/silverwrist/venice/servlets/format/AdminModifyUserDialog.java
index b88ee3e..def1893 100644
--- a/src/com/silverwrist/venice/servlets/format/AdminModifyUserDialog.java
+++ b/src/com/silverwrist/venice/servlets/format/AdminModifyUserDialog.java
@@ -18,8 +18,7 @@
package com.silverwrist.venice.servlets.format;
import java.util.*;
-import com.silverwrist.util.LocaleFactory;
-import com.silverwrist.util.StringUtil;
+import com.silverwrist.util.*;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.security.Role;
@@ -31,7 +30,7 @@ public class AdminModifyUserDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
- public AdminModifyUserDialog(List country_list)
+ public AdminModifyUserDialog()
{
super("Modify User Account",null,"moduserform","sysadmin");
setHiddenField("cmd","UM");
@@ -60,7 +59,7 @@ public class AdminModifyUserDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,true,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,true,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
- addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
+ addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Phone Numbers"));
addFormField(new CDTextFormField("phone","Telephone",null,false,32,32));
addFormField(new CDTextFormField("mobile","Mobile/cellphone",null,false,32,32));
@@ -277,7 +276,7 @@ public class AdminModifyUserDialog extends ContentDialog
// Save off the user's description and preferences.
admuser.setDescription(getFieldValue("descr"));
- admuser.setLocale(LocaleFactory.createLocale(getFieldValue("locale")));
+ admuser.setLocale(International.get().createLocale(getFieldValue("locale")));
admuser.setTimeZone(TimeZone.getTimeZone(getFieldValue("tz")));
} // end doDialog
diff --git a/src/com/silverwrist/venice/servlets/format/CDCountryListFormField.java b/src/com/silverwrist/venice/servlets/format/CDCountryListFormField.java
index 57b48c6..678d4ab 100644
--- a/src/com/silverwrist/venice/servlets/format/CDCountryListFormField.java
+++ b/src/com/silverwrist/venice/servlets/format/CDCountryListFormField.java
@@ -20,8 +20,7 @@ package com.silverwrist.venice.servlets.format;
import java.util.List;
import java.io.Writer;
import java.io.IOException;
-import com.silverwrist.util.StringUtil;
-import com.silverwrist.venice.core.Country;
+import com.silverwrist.util.*;
public class CDCountryListFormField extends CDPickListFormField
{
@@ -30,10 +29,9 @@ public class CDCountryListFormField extends CDPickListFormField
*--------------------------------------------------------------------------------
*/
- public CDCountryListFormField(String name, String caption, String caption2, boolean required,
- List country_list)
+ public CDCountryListFormField(String name, String caption, String caption2, boolean required)
{
- super(name,caption,caption2,required,country_list);
+ super(name,caption,caption2,required,International.get().getCountryList());
} // end constructor
diff --git a/src/com/silverwrist/venice/servlets/format/CDLanguageListFormField.java b/src/com/silverwrist/venice/servlets/format/CDLanguageListFormField.java
index cf1037f..f681946 100644
--- a/src/com/silverwrist/venice/servlets/format/CDLanguageListFormField.java
+++ b/src/com/silverwrist/venice/servlets/format/CDLanguageListFormField.java
@@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
- * The Original Code is the Venice Web Community System.
+ * The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox ,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@@ -20,15 +20,18 @@ package com.silverwrist.venice.servlets.format;
import java.util.List;
import java.io.Writer;
import java.io.IOException;
-import com.silverwrist.util.StringUtil;
-import com.silverwrist.venice.core.Language;
+import com.silverwrist.util.*;
public class CDLanguageListFormField extends CDPickListFormField
{
- public CDLanguageListFormField(String name, String caption, String caption2, boolean required,
- List language_list)
+ /*--------------------------------------------------------------------------------
+ * Constructors
+ *--------------------------------------------------------------------------------
+ */
+
+ public CDLanguageListFormField(String name, String caption, String caption2, boolean required)
{
- super(name,caption,caption2,required,language_list);
+ super(name,caption,caption2,required,International.get().getLanguageList());
} // end constructor
@@ -38,6 +41,11 @@ public class CDLanguageListFormField extends CDPickListFormField
} // end constructor
+ /*--------------------------------------------------------------------------------
+ * Overrides from class CDPickListFormField
+ *--------------------------------------------------------------------------------
+ */
+
protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException
{
Language l = (Language)obj;
@@ -48,6 +56,11 @@ public class CDLanguageListFormField extends CDPickListFormField
} // end renderChoice
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface CDFormField
+ *--------------------------------------------------------------------------------
+ */
+
public CDFormField duplicate()
{
return new CDLanguageListFormField(this);
diff --git a/src/com/silverwrist/venice/servlets/format/CommunityProfileData.java b/src/com/silverwrist/venice/servlets/format/CommunityProfileData.java
index 4ee0df2..063ce9f 100644
--- a/src/com/silverwrist/venice/servlets/format/CommunityProfileData.java
+++ b/src/com/silverwrist/venice/servlets/format/CommunityProfileData.java
@@ -18,7 +18,7 @@
package com.silverwrist.venice.servlets.format;
import javax.servlet.ServletRequest;
-import com.silverwrist.util.StringUtil;
+import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
public class CommunityProfileData implements JSPRender
@@ -163,7 +163,8 @@ public class CommunityProfileData implements JSPRender
public String getFullCountry()
{
- return engine.getNameOfCountry(ci.getCountry());
+ Country c = International.get().getCountryForCode(ci.getCountry());
+ return ((c==null) ? null : c.getName());
} // end getFullCountry
diff --git a/src/com/silverwrist/venice/servlets/format/CreateCommunityDialog.java b/src/com/silverwrist/venice/servlets/format/CreateCommunityDialog.java
index eb57f2f..03a338d 100644
--- a/src/com/silverwrist/venice/servlets/format/CreateCommunityDialog.java
+++ b/src/com/silverwrist/venice/servlets/format/CreateCommunityDialog.java
@@ -36,7 +36,7 @@ public class CreateCommunityDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
- public CreateCommunityDialog(List country_list, List language_list)
+ public CreateCommunityDialog()
{
super("Create New Community",null,"createcommform","sigops");
setHiddenField("cmd","C");
@@ -58,12 +58,12 @@ public class CreateCommunityDialog extends ContentDialog
addFormField(new CDVeniceIDFormField("alias","Community Alias",null,true,32,32));
addFormField(new CDTextFormField("synopsis","Synopsis",null,false,32,255));
addFormField(new CDTextFormField("rules","Rules",null,false,32,255));
- addFormField(new CDLanguageListFormField("language","Primary language",null,true,language_list));
+ addFormField(new CDLanguageListFormField("language","Primary language",null,true));
addFormField(new CDFormCategoryHeader("Location"));
addFormField(new CDTextFormField("loc","City",null,false,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,false,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
- addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
+ addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Security"));
addFormField(new CDSimplePickListFormField("comtype","Community type:",null,true,vec_pubpriv,'|'));
addFormField(new CDTextFormField("joinkey","Join key","(for private communities)",false,32,64));
diff --git a/src/com/silverwrist/venice/servlets/format/EditCommunityProfileDialog.java b/src/com/silverwrist/venice/servlets/format/EditCommunityProfileDialog.java
index 4239308..3340d20 100644
--- a/src/com/silverwrist/venice/servlets/format/EditCommunityProfileDialog.java
+++ b/src/com/silverwrist/venice/servlets/format/EditCommunityProfileDialog.java
@@ -101,7 +101,7 @@ public class EditCommunityProfileDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
- public EditCommunityProfileDialog(List country_list, List language_list)
+ public EditCommunityProfileDialog()
{
super("Edit Community Profile:",null,"commprofform","sigadmin");
setHiddenField("cmd","P");
@@ -124,7 +124,7 @@ public class EditCommunityProfileDialog extends ContentDialog
addFormField(new CDVeniceIDFormField("alias","Community Alias",null,true,32,32));
addFormField(new CDTextFormField("synopsis","Synopsis",null,false,32,255));
addFormField(new CDTextFormField("rules","Rules",null,false,32,255));
- addFormField(new CDLanguageListFormField("language","Primary language",null,true,language_list));
+ addFormField(new CDLanguageListFormField("language","Primary language",null,true));
addFormField(new CDTextFormField("url","Home page",null,false,32,255));
logo_control = new CDCommunityLogoControl("logo","Community logo","commlogo");
addFormField(logo_control);
@@ -136,7 +136,7 @@ public class EditCommunityProfileDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,false,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,false,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
- addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
+ addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Security"));
addFormField(new CDSimplePickListFormField("comtype","Communty type",null,true,vec_pubpriv,'|'));
diff --git a/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java b/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java
index f6c0b7a..dd73d72 100644
--- a/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java
+++ b/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java
@@ -20,8 +20,7 @@ package com.silverwrist.venice.servlets.format;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
-import com.silverwrist.util.LocaleFactory;
-import com.silverwrist.util.StringUtil;
+import com.silverwrist.util.*;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.core.*;
@@ -100,7 +99,7 @@ public class EditProfileDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
- public EditProfileDialog(List country_list)
+ public EditProfileDialog()
{
super("Edit Your Profile",null,"profform","account");
setHiddenField("cmd","P");
@@ -124,7 +123,7 @@ public class EditProfileDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,true,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,true,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
- addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
+ addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Phone Numbers"));
addFormField(new CDTextFormField("phone","Telephone",null,false,32,32));
addFormField(new CDTextFormField("mobile","Mobile/cellphone",null,false,32,32));
@@ -289,7 +288,7 @@ public class EditProfileDialog extends ContentDialog
// Save off the user's description and preferences.
uc.setDescription(getFieldValue("descr"));
- uc.setLocale(LocaleFactory.createLocale(getFieldValue("locale")));
+ uc.setLocale(International.get().createLocale(getFieldValue("locale")));
uc.setTimeZone(TimeZone.getTimeZone(getFieldValue("tz")));
// Finally, change the password if applicable.
diff --git a/src/com/silverwrist/venice/servlets/format/NewAccountDialog.java b/src/com/silverwrist/venice/servlets/format/NewAccountDialog.java
index c958eee..559c3ab 100644
--- a/src/com/silverwrist/venice/servlets/format/NewAccountDialog.java
+++ b/src/com/silverwrist/venice/servlets/format/NewAccountDialog.java
@@ -36,7 +36,7 @@ public class NewAccountDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
- public NewAccountDialog(List country_list)
+ public NewAccountDialog()
{
super("Create Account",null,"createform","account");
setInstructions("To create a new account, please enter your information below.");
@@ -52,7 +52,7 @@ public class NewAccountDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,true,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,true,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
- addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
+ addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("E-mail"));
addFormField(new CDEmailAddressFormField("email","E-mail address",null,true,32,255));
addFormField(new CDFormCategoryHeader("Account Information"));