Index: openacs-4/packages/acs-lang/acs-lang.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/acs-lang.info,v diff -u -r1.25 -r1.26 --- openacs-4/packages/acs-lang/acs-lang.info 24 Jun 2003 12:31:47 -0000 1.25 +++ openacs-4/packages/acs-lang/acs-lang.info 8 Aug 2003 12:21:27 -0000 1.26 @@ -7,7 +7,7 @@ t t - + oracle postgresql @@ -21,8 +21,8 @@ locale-specific formatting functions. - - + + Index: openacs-4/packages/acs-lang/sql/oracle/ad-locales.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/sql/oracle/ad-locales.sql,v diff -u -r1.14 -r1.15 --- openacs-4/packages/acs-lang/sql/oracle/ad-locales.sql 8 Aug 2003 07:24:21 -0000 1.14 +++ openacs-4/packages/acs-lang/sql/oracle/ad-locales.sql 8 Aug 2003 12:21:27 -0000 1.15 @@ -36,6 +36,9 @@ -- is this the default locale for its language default_p char(1) default 'f' constraint ad_locale_defp_tf check(default_p in ('t','f')) + enabled_p char(1) default 't' + constraint ad_locale_enp_tf check(enabled_p in ('t','f')) + ); comment on table ad_locales is ' @@ -50,173 +53,164 @@ nls_charset is Oracle charset name '; +create or replace view enabled_locales as +select * from ad_locales +where enabled_p = 't'; + insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('en_US', 'English (US)', 'en', 'US', 'AMERICAN', - 'AMERICA', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + 'AMERICA', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('en_GB', 'English (GB)', 'en', 'GB', 'ENGLISH', - 'GREAT BRITAIN', 'WE8ISO8859P1', 'ISO-8859-1', 'f'); + 'GREAT BRITAIN', 'WE8ISO8859P1', 'ISO-8859-1', 'f', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('de_DE', 'German (DE)', 'de', 'DE', 'GERMAN', - 'GERMANY', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + 'GERMANY', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('es_ES', 'Spanish (ES)', 'es', 'ES', 'SPANISH', - 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't'); + 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) -values ('ast_ES', 'Asturian (ES)', 'es', 'ES', 'SPANISH', - 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) +values ('ast_ES', 'Asturian (ES)', 'ast', 'ES', 'SPANISH', + 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) -values ('gl_ES', 'Galician-Portugese (ES)', 'es', 'ES', 'SPANISH', - 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) +values ('gl_ES', 'Galician-Portugese (ES)', 'gl', 'ES', 'SPANISH', + 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('fr_FR', 'French (FR)', 'fr', 'FR', 'FRENCH', - 'FRANCE', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + 'FRANCE', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('ja_JP', 'Japanese (JP)', 'ja', 'JP', 'JAPANESE', - 'JAPAN', 'JA16SJIS', 'Shift_JIS', 't'); + 'JAPAN', 'JA16SJIS', 'Shift_JIS', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('da_DK', 'Danish (DK)', 'da', 'DK', 'DANISH', 'DENMARK', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('da_DK', 'Danish (DK)', 'da', 'DK', 'DANISH', 'DENMARK', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('sv_SE', 'Swedish (SE)', 'sv', 'SE', 'SWEDISH', 'SWEDEN', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('sv_SE', 'Swedish (SE)', 'sv', 'SE', 'SWEDISH', 'SWEDEN', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('fi_FI', 'Finnish (FI)', 'fi', 'FI', 'FINNISH', 'FINLAND', 'WE8ISO8859P15', 'ISO-8859-15', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('fi_FI', 'Finnish (FI)', 'fi', 'FI', 'FINNISH', 'FINLAND', 'WE8ISO8859P15', 'ISO-8859-15', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('nl_NL', 'Dutch (NL)', 'nl', 'NL', 'DUTCH', 'THE NETHERLANDS', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('nl_NL', 'Dutch (NL)', 'nl', 'NL', 'DUTCH', 'THE NETHERLANDS', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ch_zh', 'Chinese (ZH)', 'CH', 'ZH', 'SIMPLIFIED CHINESE', 'CHINA', 'ZHT32EUC', 'ISO-2022-CN', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ch_zh', 'Chinese (ZH)', 'CH', 'ZH', 'SIMPLIFIED CHINESE', 'CHINA', 'ZHT32EUC', 'ISO-2022-CN', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('pl_PL', 'Polish (PL)', 'pl', 'PL', 'POLISH', 'POLAND', 'EE8ISO8859P2', 'ISO-8859-2', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('pl_PL', 'Polish (PL)', 'pl', 'PL', 'POLISH', 'POLAND', 'EE8ISO8859P2', 'ISO-8859-2', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('no_NO', 'Norwegian (NO)', 'no', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('no_NO', 'Norwegian (NO)', 'no', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('tl_PH', 'Tagalog (PH)', 'tl', 'PH', 'AMERICAN', 'ALGERIA', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('tl_PH', 'Tagalog (PH)', 'tl', 'PH', 'AMERICAN', 'ALGERIA', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('el_GR', 'Greek (GR)', 'el', 'GR', 'GREEK', 'GREECE', 'EL8ISO8859P7', 'ISO-8859-7', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('el_GR', 'Greek (GR)', 'el', 'GR', 'GREEK', 'GREECE', 'EL8ISO8859P7', 'ISO-8859-7', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('it_IT', 'Italian (IT)', 'it', 'IT', 'ITALIAN', 'ITALY', 'WE8DEC', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('it_IT', 'Italian (IT)', 'it', 'IT', 'ITALIAN', 'ITALY', 'WE8DEC', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ru_RU', 'Russian (RU)', 'ru', 'RU', 'RUSSIAN', 'CIS', 'RU8PC855', 'windows-1251', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ru_RU', 'Russian (RU)', 'ru', 'RU', 'RUSSIAN', 'CIS', 'RU8PC855', 'windows-1251', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('si_LK', 'Sinhalese (LK)','si', 'LK', 'ENGLISH', 'UNITED KINGDOM', 'UTF8', 'ISO-10646-UTF-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('si_LK', 'Sinhalese (LK)','si', 'LK', 'ENGLISH', 'UNITED KINGDOM', 'UTF8', 'ISO-10646-UTF-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('sh_HR', 'Serbo-Croatian (SR/HR)', 'sr', 'YU', 'SLOVENIAN', 'SLOVENIA', 'YUG7ASCII', 'ISO-8859-5', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('sh_HR', 'Serbo-Croatian (SR/HR)', 'sr', 'YU', 'SLOVENIAN', 'SLOVENIA', 'YUG7ASCII', 'ISO-8859-5', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('nn_NO', 'Norwegian (NN)','nn', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('nn_NO', 'Norwegian (NN)','nn', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('pt_BR', 'Portuguese (BR)', 'pt', 'BR', 'BRAZILIAN PORTUGUESE', 'BRAZIL', 'WE8ISO8859P1', 'ISO-8859-1', 't' -); + nls_charset, mime_charset, default_p, enabled_p) + values ('pt_BR', 'Portuguese (BR)', 'pt', 'BR', 'BRAZILIAN PORTUGUESE', 'BRAZIL', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('TH_TH', 'Thai (TH)', 'th', 'TH', 'THAI', 'THAILAND', 'TH8TISASCII', 'TIS-620', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('TH_TH', 'Thai (TH)', 'th', 'TH', 'THAI', 'THAILAND', 'TH8TISASCII', 'TIS-620', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('AR_EG', 'Arabic (AR_EG)', 'AR ', 'EG', 'ARABIC', 'EGYPT', 'AR8ISO8859P6', 'ISO8859-6', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('AR_EG', 'Arabic (AR_EG)', 'AR ', 'EG', 'ARABIC', 'EGYPT', 'AR8ISO8859P6', 'ISO8859-6', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('tr_TR', 'Turkish (TR)', 'tr ', 'TR', 'TURKISH', 'TURKEY', 'WE8ISO8859P9', 'ISO-8859-9', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('tr_TR', 'Turkish (TR)', 'tr ', 'TR', 'TURKISH', 'TURKEY', 'WE8ISO8859P9', 'ISO-8859-9', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ms_my', 'Malaysia (MY)', 'ms ', 'MY', 'MALAY', 'MALAYSIA', 'US7ASCII', 'US-ASCII', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ms_my', 'Malaysia (MY)', 'ms ', 'MY', 'MALAY', 'MALAYSIA', 'US7ASCII', 'US-ASCII', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('hi_IN', 'Hindi (IN)', 'hi ', 'IN', 'HINDI', 'INDIA', 'UTF8', 'UTF-8', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('hi_IN', 'Hindi (IN)', 'hi ', 'IN', 'HINDI', 'INDIA', 'UTF8', 'UTF-8', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ko_KR', 'Korean(KOR)', 'ko ', 'KR', 'KOREAN', 'KOREA', 'KO16KSC5601', 'EUC-KR', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ko_KR', 'Korean(KOR)', 'ko ', 'KR', 'KOREAN', 'KOREA', 'KO16KSC5601', 'EUC-KR', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('zh_TW', 'Chinese (TW)', 'zh ', 'TW', 'TRADITIONAL CHINESE', 'TAIWAN', 'ZHT16BIG5', 'Big5', 't'); - -create table ad_locale_user_prefs ( - user_id integer - constraint ad_locale_user_prefs_users_fk - references users (user_id) on delete cascade, - package_id integer - constraint lang_package_l_u_package_id_fk - references apm_packages(package_id) on delete cascade, - locale varchar(30) not null - constraint trb_language_preference_lid_fk - references ad_locales (locale) on delete cascade -); + nls_charset, mime_charset, default_p, enabled_p) + values ('zh_TW', 'Chinese (TW)', 'zh ', 'TW', 'TRADITIONAL CHINESE', 'TAIWAN', 'ZHT16BIG5', 'Big5', 't', 'f'); Index: openacs-4/packages/acs-lang/sql/oracle/upgrade/upgrade-4.7d9-5.0d1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/sql/oracle/upgrade/upgrade-4.7d9-5.0d1.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/sql/oracle/upgrade/upgrade-4.7d9-5.0d1.sql 8 Aug 2003 12:21:27 -0000 1.1 @@ -0,0 +1,12 @@ +-- New enabled_p column in ad_locales +alter table ad_locales + add enabled_p char(1) default 't' + constraint ad_locale_enp_tf check(enabled_p in ('t','f')); + +-- Let all locales be enabled for sites that are upgrading +update ad_locales set enabled_p = 't'; + +-- New view +create or replace view enabled_locales as +select * from ad_locales +where enabled_p = 't'; Index: openacs-4/packages/acs-lang/sql/postgresql/ad-locales.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/sql/postgresql/ad-locales.sql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-lang/sql/postgresql/ad-locales.sql 8 Aug 2003 07:24:21 -0000 1.13 +++ openacs-4/packages/acs-lang/sql/postgresql/ad-locales.sql 8 Aug 2003 12:21:27 -0000 1.14 @@ -38,7 +38,9 @@ nls_charset varchar(30), mime_charset varchar(30), -- is this the default locale for its language - default_p boolean default 'f' + default_p boolean default 'f', + -- Determines which locales a user can choose from for the UI + enabled_p boolean default 't' ); comment on table ad_locales is ' @@ -53,6 +55,10 @@ nls_charset is Oracle charset name '; +create or replace view enabled_locales as +select * from ad_locales +where enabled_p = 't'; + create table ad_locale_user_prefs ( user_id integer constraint ad_locale_user_prefs_users_fk @@ -73,162 +79,161 @@ insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('en_US', 'English (US)', 'en', 'US', 'AMERICAN', - 'AMERICA', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + 'AMERICA', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('en_GB', 'English (GB)', 'en', 'GB', 'ENGLISH', - 'GREAT BRITAIN', 'WE8ISO8859P1', 'ISO-8859-1', 'f'); + 'GREAT BRITAIN', 'WE8ISO8859P1', 'ISO-8859-1', 'f', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('de_DE', 'German (DE)', 'de', 'DE', 'GERMAN', - 'GERMANY', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + 'GERMANY', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('es_ES', 'Spanish (ES)', 'es', 'ES', 'SPANISH', - 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't'); + 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) -values ('ast_ES', 'Asturian (ES)', 'es', 'ES', 'SPANISH', - 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) +values ('ast_ES', 'Asturian (ES)', 'ast', 'ES', 'SPANISH', + 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) -values ('gl_ES', 'Galician-Portugese (ES)', 'es', 'ES', 'SPANISH', - 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) +values ('gl_ES', 'Galician-Portugese (ES)', 'gl', 'ES', 'SPANISH', + 'SPAIN', 'WE8DEC', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('fr_FR', 'French (FR)', 'fr', 'FR', 'FRENCH', - 'FRANCE', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + 'FRANCE', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) + nls_charset, mime_charset, default_p, enabled_p) values ('ja_JP', 'Japanese (JP)', 'ja', 'JP', 'JAPANESE', - 'JAPAN', 'JA16SJIS', 'Shift_JIS', 't'); + 'JAPAN', 'JA16SJIS', 'Shift_JIS', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('da_DK', 'Danish (DK)', 'da', 'DK', 'DANISH', 'DENMARK', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('da_DK', 'Danish (DK)', 'da', 'DK', 'DANISH', 'DENMARK', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('sv_SE', 'Swedish (SE)', 'sv', 'SE', 'SWEDISH', 'SWEDEN', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('sv_SE', 'Swedish (SE)', 'sv', 'SE', 'SWEDISH', 'SWEDEN', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('fi_FI', 'Finnish (FI)', 'fi', 'FI', 'FINNISH', 'FINLAND', 'WE8ISO8859P15', 'ISO-8859-15', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('fi_FI', 'Finnish (FI)', 'fi', 'FI', 'FINNISH', 'FINLAND', 'WE8ISO8859P15', 'ISO-8859-15', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('nl_NL', 'Dutch (NL)', 'nl', 'NL', 'DUTCH', 'THE NETHERLANDS', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('nl_NL', 'Dutch (NL)', 'nl', 'NL', 'DUTCH', 'THE NETHERLANDS', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ch_zh', 'Chinese (ZH)', 'CH', 'ZH', 'SIMPLIFIED CHINESE', 'CHINA', 'ZHT32EUC', 'ISO-2022-CN', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ch_zh', 'Chinese (ZH)', 'CH', 'ZH', 'SIMPLIFIED CHINESE', 'CHINA', 'ZHT32EUC', 'ISO-2022-CN', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('pl_PL', 'Polish (PL)', 'pl', 'PL', 'POLISH', 'POLAND', 'EE8ISO8859P2', 'ISO-8859-2', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('pl_PL', 'Polish (PL)', 'pl', 'PL', 'POLISH', 'POLAND', 'EE8ISO8859P2', 'ISO-8859-2', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('no_NO', 'Norwegian (NO)', 'no', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('no_NO', 'Norwegian (NO)', 'no', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't', 't'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('tl_PH', 'Tagalog (PH)', 'tl', 'PH', 'AMERICAN', 'ALGERIA', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('tl_PH', 'Tagalog (PH)', 'tl', 'PH', 'AMERICAN', 'ALGERIA', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('el_GR', 'Greek (GR)', 'el', 'GR', 'GREEK', 'GREECE', 'EL8ISO8859P7', 'ISO-8859-7', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('el_GR', 'Greek (GR)', 'el', 'GR', 'GREEK', 'GREECE', 'EL8ISO8859P7', 'ISO-8859-7', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('it_IT', 'Italian (IT)', 'it', 'IT', 'ITALIAN', 'ITALY', 'WE8DEC', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('it_IT', 'Italian (IT)', 'it', 'IT', 'ITALIAN', 'ITALY', 'WE8DEC', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ru_RU', 'Russian (RU)', 'ru', 'RU', 'RUSSIAN', 'CIS', 'RU8PC855', 'windows-1251', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ru_RU', 'Russian (RU)', 'ru', 'RU', 'RUSSIAN', 'CIS', 'RU8PC855', 'windows-1251', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('si_LK', 'Sinhalese (LK)','si', 'LK', 'ENGLISH', 'UNITED KINGDOM', 'UTF8', 'ISO-10646-UTF-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('si_LK', 'Sinhalese (LK)','si', 'LK', 'ENGLISH', 'UNITED KINGDOM', 'UTF8', 'ISO-10646-UTF-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('sh_HR', 'Serbo-Croatian (SR/HR)', 'sr', 'YU', 'SLOVENIAN', 'SLOVENIA', 'YUG7ASCII', 'ISO-8859-5', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('sh_HR', 'Serbo-Croatian (SR/HR)', 'sr', 'YU', 'SLOVENIAN', 'SLOVENIA', 'YUG7ASCII', 'ISO-8859-5', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('nn_NO', 'Norwegian (NN)','nn', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('nn_NO', 'Norwegian (NN)','nn', 'NO', 'NORWEGIAN', 'NORWAY', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('pt_BR', 'Portuguese (BR)', 'pt', 'BR', 'BRAZILIAN PORTUGUESE', 'BRAZIL', 'WE8ISO8859P1', 'ISO-8859-1', 't' -); + nls_charset, mime_charset, default_p, enabled_p) + values ('pt_BR', 'Portuguese (BR)', 'pt', 'BR', 'BRAZILIAN PORTUGUESE', 'BRAZIL', 'WE8ISO8859P1', 'ISO-8859-1', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('TH_TH', 'Thai (TH)', 'th', 'TH', 'THAI', 'THAILAND', 'TH8TISASCII', 'TIS-620', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('TH_TH', 'Thai (TH)', 'th', 'TH', 'THAI', 'THAILAND', 'TH8TISASCII', 'TIS-620', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('AR_EG', 'Arabic (AR_EG)', 'AR ', 'EG', 'ARABIC', 'EGYPT', 'AR8ISO8859P6', 'ISO8859-6', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('AR_EG', 'Arabic (AR_EG)', 'AR ', 'EG', 'ARABIC', 'EGYPT', 'AR8ISO8859P6', 'ISO8859-6', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('tr_TR', 'Turkish (TR)', 'tr ', 'TR', 'TURKISH', 'TURKEY', 'WE8ISO8859P9', 'ISO-8859-9', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('tr_TR', 'Turkish (TR)', 'tr ', 'TR', 'TURKISH', 'TURKEY', 'WE8ISO8859P9', 'ISO-8859-9', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ms_my', 'Malaysia (MY)', 'ms ', 'MY', 'MALAY', 'MALAYSIA', 'US7ASCII', 'US-ASCII', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ms_my', 'Malaysia (MY)', 'ms ', 'MY', 'MALAY', 'MALAYSIA', 'US7ASCII', 'US-ASCII', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('hi_IN', 'Hindi (IN)', 'hi ', 'IN', 'HINDI', 'INDIA', 'UTF8', 'UTF-8', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('hi_IN', 'Hindi (IN)', 'hi ', 'IN', 'HINDI', 'INDIA', 'UTF8', 'UTF-8', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('ko_KR', 'Korean(KOR)', 'ko ', 'KR', 'KOREAN', 'KOREA', 'KO16KSC5601', 'EUC-KR', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('ko_KR', 'Korean(KOR)', 'ko ', 'KR', 'KOREAN', 'KOREA', 'KO16KSC5601', 'EUC-KR', 't', 'f'); insert into ad_locales (locale, label, language, country, nls_language, nls_territory, - nls_charset, mime_charset, default_p) - values ('zh_TW', 'Chinese (TW)', 'zh ', 'TW', 'TRADITIONAL CHINESE', 'TAIWAN', 'ZHT16BIG5', 'Big5', 't'); + nls_charset, mime_charset, default_p, enabled_p) + values ('zh_TW', 'Chinese (TW)', 'zh ', 'TW', 'TRADITIONAL CHINESE', 'TAIWAN', 'ZHT16BIG5', 'Big5', 't', 'f'); end; Index: openacs-4/packages/acs-lang/sql/postgresql/message-catalog.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/sql/postgresql/message-catalog.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-lang/sql/postgresql/message-catalog.sql 26 Feb 2003 09:45:54 -0000 1.8 +++ openacs-4/packages/acs-lang/sql/postgresql/message-catalog.sql 8 Aug 2003 12:21:27 -0000 1.9 @@ -70,6 +70,12 @@ references ad_locales(locale) constraint lang_messages_audit_l_nn not null, + + -- LARS: This is really the old, overwritten message, not the new message being + -- entered on this date by this user. + -- The column should either be renamed 'old_message', or change + -- semantics to be the message being inserted on this date. + message text, overwrite_date date default now() not null, overwrite_user integer Index: openacs-4/packages/acs-lang/sql/postgresql/upgrade/upgrade-4.7d9-5.0d1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/sql/postgresql/upgrade/upgrade-4.7d9-5.0d1.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/sql/postgresql/upgrade/upgrade-4.7d9-5.0d1.sql 8 Aug 2003 12:21:27 -0000 1.1 @@ -0,0 +1,13 @@ +-- New enabled_p column in ad_locales +alter table ad_locales + add enabled_p boolean; +alter table ad_locales +alter enabled_p set default 't'; + +-- Let all locales be enabled for sites that are upgrading +update ad_locales set enabled_p = 't'; + +-- New view +create or replace view enabled_locales as +select * from ad_locales +where enabled_p = 't'; Index: openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 12 Jul 2003 01:10:36 -0000 1.17 +++ openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 8 Aug 2003 12:21:27 -0000 1.18 @@ -132,7 +132,7 @@ array set key_text_array {} foreach message_node $message_node_list { set key [get_required_xml_attribute $message_node ${KEY_ATTR}] - set text [get_required_xml_content $message_node] + set text [xml_node_get_content $message_node ] set key_text_array($key) $text } @@ -157,21 +157,6 @@ return $value } - ad_proc -private get_required_xml_content { element } { - Get the content of the given element and raise an error - if the content is empty. - - @author Peter Marklund (peter@collaboraid.biz) - } { - set content [xml_node_get_content $element] - - if { [empty_string_p $content] } { - error "Required content missing from element <[xml_node_get_name $element]>" - } - - return $content - } - ad_proc -public export_package_to_files { package_key } { Export all messages of the given package from the database to xml catalog files. The messages for each locale are stored in its own file. Index: openacs-4/packages/acs-lang/tcl/lang-message-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-message-procs.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-lang/tcl/lang-message-procs.xql 13 Jan 2003 22:51:45 -0000 1.5 +++ openacs-4/packages/acs-lang/tcl/lang-message-procs.xql 8 Aug 2003 12:21:27 -0000 1.6 @@ -47,4 +47,11 @@ + + + insert into lang_messages (package_key, message_key, locale, message, upgrade_status) + values (:package_key, :message_key, :locale, null, :message_upgrade_status) + + + Index: openacs-4/packages/acs-lang/tcl/locale-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/Attic/locale-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-lang/tcl/locale-procs-postgresql.xql 17 May 2003 09:48:30 -0000 1.4 +++ openacs-4/packages/acs-lang/tcl/locale-procs-postgresql.xql 8 Aug 2003 12:21:27 -0000 1.5 @@ -6,7 +6,11 @@ - select timezone__get_offset (timezone__get_id(:system_timezone), current_timestamp) + select (extract(epoch from current_timestamp + + timezone__get_offset (timezone__get_id(:system_timezone), current_timestamp) + ) + - extract(epoch from current_timestamp) + ) / 60/60; Index: openacs-4/packages/acs-lang/tcl/locale-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/locale-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-lang/tcl/locale-procs.tcl 17 May 2003 09:48:30 -0000 1.11 +++ openacs-4/packages/acs-lang/tcl/locale-procs.tcl 8 Aug 2003 12:21:27 -0000 1.12 @@ -373,6 +373,40 @@ set locale [lang::user::site_wide_locale] } + # LARS TODO: Pull this out into a proc and write an automated test for it + set acclang [ns_set iget [ns_conn headers] "accept-language"] + + # Split by comma, and get rid of any ;q=0.5 parts + # acclang is something like 'da,en-us;q=0.8,es-ni;q=0.5,de;q=0.3' + set acclangv [list] + foreach elm [split $acclang ","] { + # Get rid of trailing ;q=0.5 part + set elm [lindex [split $elm ";"] 0] + + # elm is now either like 'da' or 'en-us' + # make it into something like 'da' or 'en_US' + set elmv [split $elm "-"] + set elm [lindex $elmv 0] + if { [llength $elmv] > 1 } { + append elm "_[string toupper [lindex $elmv 1]]" + } + + lappend acclangv $elm + } + + # acclangv is now a list of languages/locales of the form: + # { da en_US es_NI de } + + # LARS TODO: Run through the list, and the locales available on this system, and pick the most reasonable match + # If accept-headers has language without country, and we have that language available, that's a perfect match + # If accept-headesr has language+country, and we have that language+country, that's a perfect match + # If accept-headesr has language+country, and we have that language but with another country, that's a tentative match + + # Tentative match means we'll continue to search for a perfect match, but if we don't find any perfect match, we'll use the tentative one + + + + # if that does not exist use system's site wide locale if { [empty_string_p $locale] } { Index: openacs-4/packages/acs-lang/tcl/localization-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/Attic/localization-procs-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-lang/tcl/localization-procs-postgresql.xql 9 Mar 2002 02:00:02 -0000 1.3 +++ openacs-4/packages/acs-lang/tcl/localization-procs-postgresql.xql 8 Aug 2003 12:21:27 -0000 1.4 @@ -6,7 +6,7 @@ - select to_char(timezone__utc_to_local(timezone__get_id(:tz), to_date(:time_value, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS'); + select to_char(timezone__convert_to_local(timezone__get_id(:tz), :time_value), 'YYYY-MM-DD HH24:MI:SS') @@ -15,7 +15,7 @@ - select to_char(timezone__local_to_utc(timezone__get_id(:tz), to_date(:time_value, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS'); + select to_char(timezone__convert_to_utc(timezone__get_id(:tz), :time_value), 'YYYY-MM-DD HH24:MI:SS') Index: openacs-4/packages/acs-lang/www/change-locale-include.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/change-locale-include.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-lang/www/change-locale-include.tcl 13 Feb 2003 14:26:17 -0000 1.6 +++ openacs-4/packages/acs-lang/www/change-locale-include.tcl 8 Aug 2003 12:21:28 -0000 1.7 @@ -15,7 +15,7 @@ # Create a list of lists containing the possible locale choiches -set list_of_locales [db_list_of_lists locale_loop { select label, locale from ad_locales }] +set list_of_locales [db_list_of_lists locale_loop { select label, locale from enabled_locales order by label }] set list_of_locales [linsert $list_of_locales 0 [list (default) ""]] form create locale Index: openacs-4/packages/acs-lang/www/admin/batch-editor-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/batch-editor-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/www/admin/batch-editor-oracle.xql 8 Aug 2003 12:21:28 -0000 1.1 @@ -0,0 +1,31 @@ + + + + oracle8.1.6 + + + + + select q2.* + from (select rownum as inner_rownum, q.* + from (select lm1.message_key, + lm1.package_key, + lm1.message as default_message, + lm2.message as translated_message + from lang_messages lm1, + lang_messages lm2 + where lm1.locale = :default_locale + and lm2.locale (+) = :locale + and lm2.message_key (+) = lm1.message_key + and lm2.package_key (+) = lm1.package_key + and lm1.package_key = :package_key + order by upper(lm1.message_key) + ) q + ) q2 + where inner_rownum between :page_start + 1 and :page_start + 10 + order by inner_rownum + + + + + Index: openacs-4/packages/acs-lang/www/admin/batch-editor-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/batch-editor-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/www/admin/batch-editor-postgresql.xql 8 Aug 2003 12:21:28 -0000 1.1 @@ -0,0 +1,24 @@ + + +postgresql7.1 + + + + + select lm1.message_key, + lm1.package_key, + lm1.message as default_message, + coalesce(lm2.message, 'TRANSLATION MISSING') as translated_message + from lang_messages lm1 left outer join + lang_messages lm2 on (lm2.locale = :locale and lm2.message_key = lm1.message_key and lm2.package_key = lm1.package_key) + where lm1.locale = :default_locale + and lm1.package_key = :package_key + order by upper(lm1.message_key) + offset $page_start + limit 10 + + + + + + Index: openacs-4/packages/acs-lang/www/admin/batch-editor.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/batch-editor.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-lang/www/admin/batch-editor.adp 22 May 2003 14:05:12 -0000 1.3 +++ openacs-4/packages/acs-lang/www/admin/batch-editor.adp 8 Aug 2003 12:21:28 -0000 1.4 @@ -5,25 +5,46 @@

You are editing locale: @locale_label@ [ @current_locale@ ]

- - - - - - - - - - -
@pagination.text@ - - - - @pagination.text@ - -
+

+ + + + + + + + + +
@pagination.text@ + + + + @pagination.text@ + +
+

- + +

+ + + + + + + + + +
@pagination.text@ + + + + @pagination.text@ + +
+

+
+ Index: openacs-4/packages/acs-lang/www/admin/batch-editor.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/batch-editor.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/batch-editor.tcl 3 Dec 2002 17:27:23 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/batch-editor.tcl 8 Aug 2003 12:21:28 -0000 1.3 @@ -3,32 +3,32 @@ @author Christian Hvid } { - locales + locale package_key {page_start 0} {page_end 10} } -properties { } -if { ![info exists locales] } { +if { ![info exists locale] } { set current_locale [ad_conn locale] } else { - set current_locale $locales + set current_locale $locale } db_1row select_locale_lable { select label as locale_label from ad_locales where locale = :current_locale } set tab [ns_urlencode "localized-messages"] -set return_url "display-grouped-messages?tab=$tab&locales=$locales" +set return_url "display-grouped-messages?tab=$tab&locale=$locale" set context_bar [ad_context_bar [list $return_url Listing] "Batch Editor - $package_key"] form create batch_editor # export variables -element create batch_editor locales -widget hidden -datatype text -value $locales +element create batch_editor locale -widget hidden -datatype text -value $locale element create batch_editor package_key -widget hidden -datatype text -value $package_key element create batch_editor page_start -widget hidden -datatype text -value $page_start element create batch_editor page_end -widget hidden -datatype text -value $page_end @@ -39,43 +39,46 @@ set count 0 set keys [list] set displayed_keys [list] -db_foreach get_messages { - select lm1.message_key as message_key, - lm1.message as default_message - from lang_messages lm1 - where lm1.locale = 'en_US' and - lm1.package_key = :package_key - order by upper(lm1.message_key) -} { - lappend keys [string tolower $message_key] - if {($count >= $page_start) && ($count < $page_end)} { - set translated_message "TRANSLATION MISSING" - db_0or1row get_translated_message { - select message as translated_message - from lang_messages - where package_key =:package_key and - message_key =:message_key and - locale =:current_locale - } - lappend displayed_keys $message_key - element create batch_editor "message_key_$count" -widget hidden -datatype text - element create batch_editor "message_key_info_$count" -widget inform -datatype text -label "key" - element create batch_editor "en_us_message_$count" -widget inform -datatype text -label "American" - element create batch_editor "message_$count" -widget textarea -datatype text -label $locale_label -html {cols 60 rows 4} - element set_properties batch_editor "message_key_$count" -value $message_key - element set_properties batch_editor "message_key_info_$count" -value "$message_key" - element set_properties batch_editor "en_us_message_$count" -value "[ad_quotehtml $default_message]" - if { [form is_request batch_editor] } { - element set_properties batch_editor "message_$count" -value $translated_message - } - } +set default_locale en_US +set default_locale_label [ad_locale_get_label $default_locale] +set keys [util_memoize [list db_list get_keys "select message_key from lang_message_keys where package_key = '[db_quote $package_key]' order by upper(message_key)"]] +set keys [db_list get_keys "select message_key from lang_message_keys where package_key = '[db_quote $package_key]' order by upper(message_key)"] + +set total [llength $keys] + +# TODO: Oracle +db_foreach get_messages {} { + lappend displayed_keys $message_key + element create batch_editor "message_key_$count" -widget hidden -datatype text + + element create batch_editor "message_key_info_$count" -widget inform -datatype text -label "Key" + + element create batch_editor "en_us_message_$count" -widget inform -datatype text -label $default_locale_label + + if { [string length $translated_message] > 150 } { + set html { cols 80 rows 15 } + } else { + set html { cols 60 rows 4 } + } + element create batch_editor "message_$count" -widget textarea -datatype text -label $locale_label -html $html + + element set_value batch_editor "message_key_$count" $message_key + + element set_value batch_editor "message_key_info_$count" "$message_key" + + element set_properties batch_editor "en_us_message_$count" -value "[ad_quotehtml $default_message]" + + if { [form is_request batch_editor] } { + element set_properties batch_editor "message_$count" -value [ad_decode $translated_message "" "TRANSLATION MISSING" $translated_message] + } + incr count } -set total $count + # create pagination multiple multirow create pagination text hint url selected group @@ -84,12 +87,22 @@ if { $end_page > [expr $total-1] } { set end_page [expr $total-1] } - if { ([string range [lindex $keys $count] 0 2] == "lt_") && ([string range [lindex $keys $end_page] 0 2] == "lt_") } { - set text "[string range [lindex $keys $count] 2 4] - [string range [lindex $keys $end_page] 2 4]" + + + set text {} + if { [string match "lt_*" [lindex $keys $count]] } { + append text [string range [lindex $keys $count] 3 5] } else { - set text "[string range [lindex $keys $count] 0 2] - [string range [lindex $keys $end_page] 0 2]" + append text [string range [lindex $keys $count] 0 2] } - multirow append pagination $text "[lindex $keys $count] - [lindex $keys $end_page]" "batch-editor?page_start=$count&page_end=[expr $count+10]&locales=$locales&package_key=$package_key" [expr $count == $page_start] [expr $count / 100] + append text " - " + if { [string match "lt_*" [lindex $keys $end_page]] } { + append text [string range [lindex $keys $end_page] 3 5] + } else { + append text [string range [lindex $keys $end_page] 0 2] + } + + multirow append pagination $text "[lindex $keys $count] - [lindex $keys $end_page]" "batch-editor?page_start=$count&page_end=[expr $count+10]&locale=$locale&package_key=$package_key" [expr $count == $page_start] [expr $count / 100] } # is this a valid submit? then register the messages @@ -101,7 +114,7 @@ set message [element get_value batch_editor "message_$count"] if { $message != "TRANSLATION MISSING" } { - lang::message::register $locales $package_key $message_key $message + lang::message::register $locale $package_key $message_key $message } } } Index: openacs-4/packages/acs-lang/www/admin/display-grouped-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/display-grouped-messages.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-lang/www/admin/display-grouped-messages.adp 22 May 2003 14:05:12 -0000 1.6 +++ openacs-4/packages/acs-lang/www/admin/display-grouped-messages.adp 8 Aug 2003 12:21:28 -0000 1.7 @@ -6,6 +6,10 @@

Your locale is @locale_label@ [ @current_locale@ ]

+

+ » Search localized messages +

+

Note from the system: NO messages need to be translated. Job well done :-)

@@ -39,9 +43,9 @@ @all_packages_group.package_key@ - (batch edit) + (batch edit) - (new) + (new message key) @@ -82,9 +86,9 @@ @missing_translation_group.package_key@ - (edit untranslated) + (edit untranslated) - (new) + (new message key) @@ -127,9 +131,9 @@ @translated_messages_group.package_key@ - (edit translated) + (edit translated) - (new) + (new message key) Index: openacs-4/packages/acs-lang/www/admin/display-grouped-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/display-grouped-messages.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-lang/www/admin/display-grouped-messages.tcl 12 Nov 2002 15:34:23 -0000 1.4 +++ openacs-4/packages/acs-lang/www/admin/display-grouped-messages.tcl 8 Aug 2003 12:21:28 -0000 1.5 @@ -7,7 +7,7 @@ @creation-date 26 October 2001 @cvs-id $Id$ } { - locales:optional + locale:optional } -properties { } @@ -16,10 +16,10 @@ set context_bar [ad_context_bar $page_title] set default_locale en_US -if { ![info exists locales] } { +if { ![info exists locale] } { set current_locale [ad_conn locale] } else { - set current_locale $locales + set current_locale $locale } # Query to get all packages that are prepared for translation @@ -83,3 +83,5 @@ } else { set new_allowed_p 0 } + +set message_search_url "message-search?[export_vars { locale }]" Index: openacs-4/packages/acs-lang/www/admin/display-localized-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/display-localized-messages.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-lang/www/admin/display-localized-messages.adp 22 May 2003 14:05:12 -0000 1.6 +++ openacs-4/packages/acs-lang/www/admin/display-localized-messages.adp 8 Aug 2003 12:21:28 -0000 1.7 @@ -30,7 +30,7 @@ @missing_translation.default_message@ TRANSLATION MISSING - (edit) + (edit) @@ -64,7 +64,7 @@ @translated_messages.message_key@ @translated_messages.default_message@ @translated_messages.translated_message@ - (edit) + (edit) Index: openacs-4/packages/acs-lang/www/admin/display-localized-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/display-localized-messages.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-lang/www/admin/display-localized-messages.tcl 12 Nov 2002 15:34:23 -0000 1.4 +++ openacs-4/packages/acs-lang/www/admin/display-localized-messages.tcl 8 Aug 2003 12:21:28 -0000 1.5 @@ -7,14 +7,14 @@ @creation-date 26 October 2001 @cvs-id $Id$ } { - locales + locale translated_p package_key } -properties { } set tab [ns_urlencode "localized-messages"] -set return_url "display-grouped-messages?tab=$tab&locales=$locales" +set return_url "display-grouped-messages?tab=$tab&locale=$locale" if { ! $translated_p } { set title "Edit Untranslated - $package_key" @@ -27,10 +27,10 @@ set default_locale [ad_parameter DefaultLocale] set default_locale en_US -if { ![info exists locales] } { +if { ![info exists locale] } { set current_locale [ad_conn locale] } else { - set current_locale $locales + set current_locale $locale } # Query to get all the messages that DO NOT have a translation to the @@ -68,16 +68,27 @@ order by upper(lm1.message_key) } -template::multirow create missing_translation message_key locale default_message escaped_key escaped_language -template::multirow create translated_messages message_key locale default_message translated_message escaped_key escaped_language +multirow create missing_translation message_key locale default_message escaped_key escaped_language +multirow create translated_messages message_key locale default_message translated_message escaped_key escaped_language if { ! $translated_p } { db_foreach select_messages_not_translated $cat_msg_not_translated { - template::multirow append missing_translation $message_key $current_locale [ad_quotehtml $default_message] [ns_urlencode $message_key] [ns_urlencode $current_locale] + multirow append missing_translation \ + $message_key \ + $current_locale \ + $default_message \ + [ns_urlencode $message_key] \ + [ns_urlencode $current_locale] } } else { db_foreach select_messages_translated $cat_msg_translated { - template::multirow append translated_messages $message_key $current_locale [ad_quotehtml $default_message] [ad_quotehtml $translated_message] [ns_urlencode $message_key] [ns_urlencode $current_locale] + multirow append translated_messages \ + $message_key \ + $current_locale \ + $default_message \ + $translated_message \ + [ns_urlencode $message_key] \ + [ns_urlencode $current_locale] } } Index: openacs-4/packages/acs-lang/www/admin/edit-localized-message.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/edit-localized-message.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-lang/www/admin/edit-localized-message.tcl 4 Dec 2002 16:29:41 -0000 1.5 +++ openacs-4/packages/acs-lang/www/admin/edit-localized-message.tcl 8 Aug 2003 12:21:28 -0000 1.6 @@ -9,25 +9,25 @@ @cvs-id $Id$ } { - locales + locale message_key package_key {translated_p 0} - {return_url "display-localized-messages?[export_vars { package_key locales translated_p }]"} + {return_url "display-localized-messages?[export_vars { package_key locale translated_p }]"} } -properties { } -if {[info exists locales]} { - set current_locale $locales +if {[info exists locale]} { + set current_locale $locale } else { set current_locale [ad_conn locale] } set tab [ns_urlencode "localized-messages"] set context_bar [ad_context_bar [list "index?tab=$tab" "Locales & Messages"] \ - [list "display-grouped-messages?tab=$tab&locales=$locales" "Listing"] \ - [list "display-localized-messages?[export_vars { package_key locales translated_p }]" "Messages"] "Edit"] + [list "display-grouped-messages?tab=$tab&locale=$locale" "Listing"] \ + [list "display-localized-messages?[export_vars { package_key locale translated_p }]" "Messages"] "Edit"] # This has an ugly smell: But let's hardcode the default to en_US @@ -51,7 +51,7 @@ element create message_editing package_key -datatype text -widget hidden -element create message_editing locales -datatype text -widget hidden +element create message_editing locale -datatype text -widget hidden element create message_editing translated_p -label "translated_p" -datatype text -widget hidden -value $translated_p element create message_editing return_url -datatype text -widget hidden -value $return_url @@ -95,7 +95,7 @@ element set_properties message_editing message_key -value $message_key element set_properties message_editing package_key -value $package_key - element set_properties message_editing locales -value $current_locale + element set_properties message_editing locale -value $current_locale element set_properties message_editing original_message -value [ad_quotehtml $message] } else { @@ -128,15 +128,15 @@ # We get the values from the form form get_values message_editing message_key form get_values message_editing package_key - form get_values message_editing locales + form get_values message_editing locale form get_values message_editing message form get_values message_editing return_url # Register message via acs-lang - lang::message::register $locales $package_key $message_key $message + lang::message::register $locale $package_key $message_key $message # Even if the country code is 2 chars, we avoid problems... - set escaped_locale [ns_urlencode $locales] + set escaped_locale [ns_urlencode $locale] forward $return_url Index: openacs-4/packages/acs-lang/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/index.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-lang/www/admin/index.adp 22 May 2003 14:05:12 -0000 1.9 +++ openacs-4/packages/acs-lang/www/admin/index.adp 8 Aug 2003 12:21:28 -0000 1.10 @@ -12,46 +12,28 @@
- +

Here you can edit locales and internationalize messages in the user interface of the system.

- -

Here you can edit locales and internationalize messages in the user interface of the system.

- -
- - - +

System Locales

- - - +
+ + +

Timezone

+ +

+ » + Set system timezone +

+
+ Index: openacs-4/packages/acs-lang/www/admin/locale-delete-confirm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/locale-delete-confirm.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-lang/www/admin/locale-delete-confirm.adp 22 May 2003 14:05:12 -0000 1.5 +++ openacs-4/packages/acs-lang/www/admin/locale-delete-confirm.adp 8 Aug 2003 12:21:28 -0000 1.6 @@ -5,6 +5,6 @@

Are you sure you want to proceed?

-@confirm_data@ +@confirm_data;noquote@
Index: openacs-4/packages/acs-lang/www/admin/locale-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/locale-delete.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-lang/www/admin/locale-delete.adp 22 May 2003 14:05:12 -0000 1.5 +++ openacs-4/packages/acs-lang/www/admin/locale-delete.adp 8 Aug 2003 12:21:28 -0000 1.6 @@ -3,5 +3,5 @@ @context_bar;noquote@

-

Deleting locale @locale_label@ [ @locales@ ]

+

Deleting locale @locale_label@ [ @locale@ ]

Index: openacs-4/packages/acs-lang/www/admin/locale-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/locale-delete.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/locale-delete.tcl 21 Oct 2002 11:39:14 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/locale-delete.tcl 8 Aug 2003 12:21:28 -0000 1.3 @@ -8,16 +8,12 @@ @creation-date 19 march 2002 @cvs-id $Id$ } { - locales + locale } -properties { } -# Get the locale for the user so that we 'spit' the content back in the -# proper locale -set locale_user [ad_locale_locale_from_lang [ad_locale user language]] +set context_bar [ad_context_bar "Deleting Locale"] -set context_bar [ad_context_bar "Deleting Locales"] - form create locale_deleting # It's a request, not a submission of the form @@ -45,8 +41,8 @@ element create locale_deleting default_p -label "Default" \ -datatype text -widget hidden -element create locale_deleting locales -p label "Locales" \ - -datatype text -widget hidden -value $locales +element create locale_deleting locale -p label "Locale" \ + -datatype text -widget hidden -value $locale if { [form is_request locale_deleting] } { @@ -57,7 +53,7 @@ nls_territory as locale_nls_territory, nls_charset as locale_nls_charset, mime_charset as locale_mime_charset, default_p as locale_default_p from ad_locales - where locale = :locales" + where locale = :locale" element set_properties locale_deleting label -value $locale_label element set_properties locale_deleting language -value $locale_language element set_properties locale_deleting country -value $locale_country @@ -73,8 +69,12 @@ db_transaction { - db_dml delete_locale "delete from ad_locales where locale = :locales" + db_dml delete_messages { delete from lang_messages where locale = :locale } + db_dml delete_audit { delete from lang_messages_audit where locale = :locale } + + db_dml delete_locale { delete from ad_locales where locale = :locale } + } forward "index?tab=locales" Index: openacs-4/packages/acs-lang/www/admin/locale-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/locale-edit.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-lang/www/admin/locale-edit.adp 22 May 2003 14:05:12 -0000 1.5 +++ openacs-4/packages/acs-lang/www/admin/locale-edit.adp 8 Aug 2003 12:21:28 -0000 1.6 @@ -4,6 +4,6 @@

Please update the necesary fields and press "Submit"

-

Editing locale @locale_label@ [ @locales@ ]

+

Editing locale @locale_label@ [ @locale@ ]

Index: openacs-4/packages/acs-lang/www/admin/locale-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/locale-edit.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-lang/www/admin/locale-edit.tcl 15 Nov 2002 15:05:37 -0000 1.4 +++ openacs-4/packages/acs-lang/www/admin/locale-edit.tcl 8 Aug 2003 12:21:28 -0000 1.5 @@ -9,7 +9,7 @@ @creation-date 19 march 2002 @cvs-id $Id$ } { - locales + locale } -properties { } @@ -98,8 +98,8 @@ element create locale_editing default_p -label "Default" \ -datatype text -widget hidden -element create locale_editing locales -p label "Locales" \ - -datatype text -widget hidden -value $locales +element create locale_editing locale -p label "Locale" \ + -datatype text -widget hidden -value $locale if { [form is_request locale_editing] } { @@ -110,7 +110,7 @@ nls_territory as locale_nls_territory, nls_charset as locale_nls_charset, mime_charset as locale_mime_charset, default_p as locale_default_p from ad_locales - where locale = :locales" + where locale = :locale" element set_properties locale_editing label -value $locale_label element set_properties locale_editing language -value $locale_language element set_properties locale_editing country -value $locale_country @@ -127,7 +127,7 @@ form get_values locale_editing - set locale_label [ad_locale_get_label $locales] + set locale_label [ad_locale_get_label $locale] if { $label == "" } { element set_error locale_editing label "Label is required" @@ -150,7 +150,7 @@ nls_language = :nls_language, nls_territory = :nls_territory, nls_charset = :nls_charset, mime_charset = :mime_charset, default_p = :default_p - where locale = :locales" + where locale = :locale" } forward "index?tab=locales" Index: openacs-4/packages/acs-lang/www/admin/locale-make-default.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/locale-make-default.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/locale-make-default.tcl 21 Oct 2002 11:39:14 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/locale-make-default.tcl 8 Aug 2003 12:21:28 -0000 1.3 @@ -8,23 +8,23 @@ @creation-date 19 march 2002 @cvs-id $Id$ } { - locales + locale } -properties { } -# If have first to revert the other locales to default_p = f +# If have first to revert the other locale to default_p = f db_transaction { set language_from_locale [db_string select_lang_from_locale "select - language from ad_locales where locale = :locales"] + language from ad_locales where locale = :locale"] - db_dml make_locales_not_default "update ad_locales set default_p = 'f' + db_dml make_locale_not_default "update ad_locales set default_p = 'f' where language = :language_from_locale and default_p = 't'" - db_dml make_locales_default "update ad_locales set default_p = 't' - where locale = :locales" + db_dml make_locale_default "update ad_locales set default_p = 't' + where locale = :locale" - util_memoize_flush [list ad_locale_locale_from_lang $locales] + util_memoize_flush [list ad_locale_locale_from_lang $locale] } Index: openacs-4/packages/acs-lang/www/admin/locale-set-enabled-p.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/locale-set-enabled-p.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/www/admin/locale-set-enabled-p.tcl 8 Aug 2003 12:21:28 -0000 1.1 @@ -0,0 +1,16 @@ +ad_page_contract { + + Enables a locale + + @author Simon Carstensen (simon@collaboraid.biz) + + @creation-date 2003-08-08 +} { + locale + enabled_p:boolean +} + +db_dml set_enabled_p { update ad_locales set enabled_p = :enabled_p where locale = :locale } + +ad_returnredirect . +ad_script_abort Index: openacs-4/packages/acs-lang/www/admin/locales.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/locales.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/locales.adp 25 Oct 2002 15:12:15 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/locales.adp 8 Aug 2003 12:21:28 -0000 1.3 @@ -1,25 +1,50 @@ -

List of Locales

- +
- + + - - + +
Locale LabelDefaultEnabledDefault Locale For Langauge Action
@locales.locale@@locales.locale_label@ - Yes - No (make default) + @locales.locale_label@ (edit)  - (delete) + + + No + + + Yes + + + + N/A + + + Yes + + + No (make default) + + (edit messages)  + (edit locale)  + (delete locale) + + (enable locale) + + + (disable locale) + +
Index: openacs-4/packages/acs-lang/www/admin/locales.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/locales.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/locales.tcl 21 Oct 2002 11:39:14 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/locales.tcl 8 Aug 2003 12:21:28 -0000 1.3 @@ -13,12 +13,28 @@ set context_bar [ad_context_bar "Locales Administration"] -db_multirow -extend { escaped_locale } locales select_locales { +db_multirow -extend { + escaped_locale + msg_edit_url + locale_edit_url + locale_delete_url + locale_make_default_url + locale_enabled_p_url +} locales select_locales { select l.locale as locale, l.label as locale_label, - l.default_p as default_p + l.default_p as default_p, + l.enabled_p as enabled_p, + (select count(*) from ad_locales l2 where l2.language = l.language) as num_locales_for_language from ad_locales l order by locale_label } { set escaped_locale [ns_urlencode $locale] + set msg_edit_url "display-grouped-messages?[export_vars { locale }]" + set locale_edit_url "locale-edit?[export_vars { locale }]" + set locale_delete_url "locale-delete?[export_vars { locale }]" + set locale_make_default_url "locale-make-default?[export_vars { locale }]" + set toggle_enabled_p [ad_decode $enabled_p "t" "f" "t"] + set locale_enabled_p_url "locale-set-enabled-p?[export_vars { locale {enabled_p $toggle_enabled_p} }]" + } Index: openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl 21 Oct 2002 11:39:14 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl 8 Aug 2003 12:21:28 -0000 1.3 @@ -9,7 +9,7 @@ @cvs-id $Id$ } { - locales + locale package_key } -properties { } @@ -19,8 +19,8 @@ # locale. If not, we can't allow the creation of a new localized # message. -if {[info exists locales]} { - set locale_user $locales +if {[info exists locale]} { + set locale_user $locale } else { set locale_user [ad_conn locale] } @@ -31,18 +31,18 @@ # ooops! # We should let the user know about this ... shouldn't we? noooooo... :) set encoded_locale [ns_urlencode $locale_user] - ad_returnredirect "display-grouped-messages?locales=$encoded_locale" + ad_returnredirect "display-grouped-messages?locale=$encoded_locale" } set locale_label [ad_locale_get_label $locale_user] -append return_url "display-grouped-messages?locales=" [ns_urlencode $locale_user] +append return_url "display-grouped-messages?locale=" [ns_urlencode $locale_user] set tab [ns_urlencode "localized-messages"] set context_bar [ad_context_bar [list "index?tab=$tab" "Locales & Messages"] \ - [list "display-grouped-messages?tab=$tab&locales=$locales" "Listing"] \ + [list "display-grouped-messages?tab=$tab&locale=$locale" "Listing"] \ "New"] template::form create message_new @@ -59,12 +59,12 @@ # The two hidden tags that we need to pass on the key and language to the # processing of the form -template::element create message_new locales -label "locale" -datatype text -widget hidden +template::element create message_new locale -label "locale" -datatype text -widget hidden if { [template::form is_request message_new] } { template::element set_properties message_new package_key -value $package_key - template::element set_properties message_new locales -value $locale_user + template::element set_properties message_new locale -value $locale_user } else { @@ -97,14 +97,14 @@ # We get the values from the form template::form get_values message_new package_key template::form get_values message_new message_key - template::form get_values message_new locales + template::form get_values message_new locale template::form get_values message_new message # We use the acs-lang registration of a translation. Simple, eh? - lang::message::register $locales $package_key $message_key $message + lang::message::register $locale $package_key $message_key $message - set escaped_locale [ns_urlencode $locales] + set escaped_locale [ns_urlencode $locale] template::forward $return_url Index: openacs-4/packages/acs-lang/www/admin/localized-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/localized-messages.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-lang/www/admin/localized-messages.adp 7 Oct 2002 14:32:48 -0000 1.1 +++ openacs-4/packages/acs-lang/www/admin/localized-messages.adp 8 Aug 2003 12:21:28 -0000 1.2 @@ -10,7 +10,7 @@
@locales.locale@@locales.locale_name@@locales.locale_name@
Index: openacs-4/packages/acs-lang/www/admin/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/master.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-lang/www/admin/master.adp 29 Jun 2003 23:32:23 -0000 1.5 +++ openacs-4/packages/acs-lang/www/admin/master.adp 8 Aug 2003 12:21:28 -0000 1.6 @@ -1,6 +1,8 @@ @title;noquote@ + @focus;noquote@ @header_stuff;noquote@ +

@context_bar;noquote@

Index: openacs-4/packages/acs-lang/www/admin/message-search-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-search-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/www/admin/message-search-oracle.xql 8 Aug 2003 12:21:28 -0000 1.1 @@ -0,0 +1,30 @@ + + + + oracle8.1.6 + + + + + select lm1.message_key, + lm1.package_key, + lm1.message as default_message, + lm2.message as translated_message + from lang_messages lm1, + lang_messages lm2 + where lm1.locale = :default_locale + and lm2.locale (+) = :locale + and lm2.message_key (+) = lm1.message_key + and lm2.package_key (+) = lm1.package_key + and exists (select 1 + from lang_messages lm3 + where lm3.locale = :search_locale + and lm3.message_key = lm1.message_key + and lm3.package_key = lm1.package_key + and upper(dbms_lob.substr(lm3.message)) like upper(:search_string)) + order by upper(lm1.message_key) + + + + + Index: openacs-4/packages/acs-lang/www/admin/message-search-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-search-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/www/admin/message-search-postgresql.xql 8 Aug 2003 12:21:28 -0000 1.1 @@ -0,0 +1,27 @@ + + +postgresql7.1 + + + + + select lm1.message_key, + lm1.package_key, + lm1.message as default_message, + coalesce(lm2.message, 'TRANSLATION MISSING') as translated_message + from lang_messages lm1 left outer join + lang_messages lm2 on (lm2.locale = :locale and lm2.message_key = lm1.message_key and lm2.package_key = lm1.package_key) + where lm1.locale = :default_locale + and exists (select 1 + from lang_messages lm3 + where lm3.locale = :search_locale + and lm3.message_key = lm1.message_key + and lm3.package_key = lm1.package_key + and lm3.message ilike :search_string) + order by upper(lm1.message_key) + + + + + + Index: openacs-4/packages/acs-lang/www/admin/message-search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-search.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/www/admin/message-search.adp 8 Aug 2003 12:21:28 -0000 1.1 @@ -0,0 +1,37 @@ + + @page_title@ + @context_bar;noquote@ + search.q + + + + +

Search Results

+ + + + + +
+ + + + + + + + + + + + + + + + + +
PackageKeyOriginal MessageTranslated MessageAction
@messages.package_key@@messages.message_key@@messages.default_message@@messages.translated_message@(edit)
+
+ + +
Index: openacs-4/packages/acs-lang/www/admin/message-search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-search.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/www/admin/message-search.tcl 8 Aug 2003 12:21:28 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + + Search for localized messages containing a certain substring, + in order to help translators ensure consistent terminology. + +} { + locale +} + +set page_title "Search Messages" +set context_bar [ad_context_bar [list "display-grouped-messages?[export_vars { locale }]" "Listing"] $page_title] + +set default_locale en_US + +set search_locales [list] +lappend search_locales [list "Current locale - [ad_locale_get_label $locale]" $locale ] +lappend search_locales [list "Master locale - [ad_locale_get_label $default_locale]" $default_locale] + +set submit_p 0 + +ad_form -name search -form { + {locale:text(hidden)} + {q:text + {label "Search message for"} + } + {search_locale:text(select) + {options $search_locales} + {label "In locale"} + } +} -on_request { + # locale will be set now +} -on_submit { + set submit_p 1 + # q and seach_locale will now be set as local variables. + + set search_string "%$q%" + + db_multirow -extend { package_url edit_url } messages select_messages {} { + set edit_url "edit-localized-message?[export_vars { message_key locale package_key {return_url {[ad_return_url]} } }]" + set package_url "batch-editor?[export_vars { package_key locale }]" + } +} + Index: openacs-4/packages/acs-lang/www/admin/set-system-timezone-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/set-system-timezone-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-lang/www/admin/set-system-timezone-postgresql.xql 3 Dec 2002 17:27:23 -0000 1.1 +++ openacs-4/packages/acs-lang/www/admin/set-system-timezone-postgresql.xql 8 Aug 2003 12:21:28 -0000 1.2 @@ -4,9 +4,17 @@ - select to_char(current_time, 'YYYY-MM-DD HH24:MI:SS') + select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS') + + + + select to_char(timezone__convert_to_utc(timezone__get_id(:system_timezone), to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS') + + + + - \ No newline at end of file + Index: openacs-4/packages/acs-lang/www/admin/set-system-timezone.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/set-system-timezone.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/set-system-timezone.adp 22 May 2003 14:05:12 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/set-system-timezone.adp 8 Aug 2003 12:21:28 -0000 1.3 @@ -55,6 +55,28 @@
+ + + + + Does the system timezone look like it's set correctly? + + + + + + YES! (Congratulations) + + + NO. Set below. + + + + + + + +

@@ -71,23 +93,48 @@ database this question automatically).

-
-Set Timezone: - - - + +

+ Based on the UTC time retrieved from timeanddate.com, we believe that your server is set to one of the following timezones: +

+

+ + + +

+

+

+ In case we're wrong, you can pick another timezone here: +

+
+ +

+ Set Timezone: +

+

+

+ + +
+

- - - Index: openacs-4/packages/acs-lang/www/admin/set-system-timezone.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/set-system-timezone.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/set-system-timezone.tcl 13 Feb 2003 14:26:50 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/set-system-timezone.tcl 8 Aug 2003 12:21:28 -0000 1.3 @@ -35,22 +35,24 @@ foreach entry [lc_list_all_timezones] { set tz [lindex $entry 0] - multirow append timezones $entry $tz [string equal $tz $system_timezone] + multirow append timezones $entry $tz [string equal $tz $system_timezone]> } # Try to get the correct UTC time from www.timeanddate.com + if { [catch { + set time_and_date_page [util_httpget "http://www.timeanddate.com/worldclock/"] regexp {Current UTC \(or GMT\)-time used: ([^<]*)} $time_and_date_page match utc_from_page # UTC in format: # Wednesday, November 20, 2002, at 2:49:07 PM + # Wednesday, August 6, 2003, at 12:11:48 + regexp {^([^,]*), *([^ ]*) *([0-9]*), *([0-9]*), at (.*)$} $utc_from_page match weekday month day year time - regexp {^([^,]*), ([^ ]*) ([0-9]*), ([0-9]*), at (.*)$} $utc_from_page match weekday month day year time - set utc_epoch [clock scan "${month} ${day}, ${year} ${time}"] - + set utc_ansi [clock format $utc_epoch -format "%Y-%m-%d %T"] } errmsg] } { @@ -60,3 +62,43 @@ set utc_ansi {Couldn't get time from timeanddate.com, sorry.} } +set correct_p {} + +if { [info exists utc_epoch] } { + with_catch errmsg { + set sysdate_utc_epoch [clock scan $sysdate_utc] + set delta_hours [expr round(($sysdate_utc_epoch - $utc_epoch)*4.0 / (60*60)) / 4.0] + set recommended_offset [expr $system_utc_offset + $delta_hours] + + if { $delta_hours == 0 } { + set correct_p 1 + } else { + set correct_p 0 + } + + set try_offsets [list] + foreach offset [list $recommended_offset [expr $recommended_offset -24]] { + lappend try_offsets [expr int($offset*60*60)] + } + + set query " + select tz.tz, tz.gmt_offset + from timezones tz, + timezone_rules tzr + where tzr.gmt_offset in ([join $try_offsets ", "]) + and tzr.tz_id = tz.tz_id + and to_date('$utc_ansi', 'YYYY-MM-DD HH24:MI:SS') between tzr.utc_start and tzr.utc_end + order by tz + " + + db_multirow -extend { value label selected_p } suggested_timezones select_suggested_timezones $query { + set selected_p [string equal $tz $system_timezone] + set value $tz + set label "$tz $gmt_offset" + } + } { + # Didn't work, too bad + global errorInfo + error $errmsg $errorInfo + } +} Index: openacs-4/packages/acs-lang/www/doc/i18n-requirements.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/doc/i18n-requirements.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-lang/www/doc/i18n-requirements.html 20 Apr 2001 20:51:09 -0000 1.1 +++ openacs-4/packages/acs-lang/www/doc/i18n-requirements.html 8 Aug 2003 12:21:28 -0000 1.2 @@ -1,688 +1,466 @@ - - - - - - -ACS 4 Globalization Requirements - - - - -

ACS 4 Globalization Requirements

- -

by Henry Minsky, Yon Feldman, Lars Pind, others

- -
- -

I. Introduction

- - -This document describes the requirements for functionality in the ACS -platform to support globalization of the core and optional -modules. The goal is to make it possible to support delivery of -applications which work properly in multiple locales with the lowest -development and maintenance cost. -

- -

Definitions

-

-

-internationalization (i18n) -

- -The provision within a computer program of the capability of making -itself adaptable to the requirements of different native languages, -local customs and coded character sets. - - -

-locale -

- -The definition of the subset of a user's environment that depends on -language and cultural conventions. - -

-localization (L10n) -

-The process of establishing information within a computer system -specific to the operation of particular native languages, local -customs and coded character sets. - -

-globalization -

-A product development approach which ensures that software products -are usable in the worldwide markets through a combination of -internationalization and localization. - -

-

- -

II. Vision Statement

- -The Mozilla project suggests keeping two catchy phrases in mind when thinking -about globalization: - -
    -
  • One code base for the world -
  • English is just another language -
- -

-Building an application often involves making a number of assumptions -on the part of the developers which depend on their own culture. These -include constant strings in the user interface and system error -messages, names of countries, cities, order of given and family names -for people, syntax of numeric and date strings and collation order of -strings. - -

- -The ACS should be able to operate in languages and regions beyond US -English. The goal of ACS Globalization is to provide a clean and -efficient way to factor out the locale dependent functionality from -our applications, in order to be able to easily swap in alternate -localizations. -

-This in turn will reduce redundant, costly, and error prone rework -when targeting the toolkit or applications built with the toolkit to -another locale. -

- -The cost of porting the ACS to another locale without some kind of -globalization support would be large and ongoing, since without a -mechanism to incorporate the locale-specific changes cleanly back into -the code base, it would require making a new fork of the source code -for each locale. - - -

III. System/Application Overview

- - -A globalized application will perform some or all of the following -steps to handle a page request for a specific locale: -

-

    -
  1. Decide what the target locale is for an incoming page request -

    -

  2. Decide which character set encoding the output should be delivered in -

    -

  3. If a script file to handle the request needs to be loaded from -disk, determine if a character set conversion needs to be performed -when loading the script -
    -

    -

  4. If needed, locale-specific resources are fetched. These can include text, graphics, -or other resources that would vary with the target locale. -

    -

  5. -If content data is fetched from the database, check for -locale-specific versions of the data (e.g. country names). -

    - - -

  6. Source code should use a message catalog API to translate constant strings in -the code to the target locale -

    -

  7. Perform locale-specific linguistic sorting on data if needed -

    -

  8. If the user submitted form input data, decide what character set -encoding conversion if any is needed. Parse locale-specific quantities -if needed (number formats, date formats). -

    -

  9. If templating is being used, select correct locale-specific template to merge with content - -

    -

  10. Format output data quantities in locale-specific manner (date, time, numeric, currency). -If templating is being used, this may be done either before and/or after merging the data with a template. -
- -

- -Since the internationalization APIs may potentially be used on every -page in an application, the overhead for adding internationalization to a -module or application must not cause a significant time delay in -handling page requests. -

-In many cases there are facilities in Oracle to perform various -localization functions, and also there are facilities in Java which we -will want to move to. So the design to meet the requirements will tend -to rely on these capabilities, or close approximations to them where -possible, in order to make it easier to maintain Tcl and Java ACS -versions. -

- - -

IV. Use-cases and User-scenarios

- -Here are the cases that we need to be able to handle efficiently: - -

-

    -
  1. - -A developer needs to author a web site/application in a language -besides English, and possibly a character set besides ISO-8859-1. This -includes the operation of the ACS itself, i.e., navigation, admin -pages for modules, error messages, as well as additional modules or -content supplied by the web site developer. -

    -What do they need to modify to make this work? Can their localization work -be easily folded in to future releases of ACS? - -

    -

  2. - -A developer needs to author a web site which operates in multiple -languages simultaneously. For example, arsDigita.com with content and -navigation in English, German, and Japanese. -

    -The site would have an end-user visible UI to support these languages, -and the content management system must allow articles to be posted in -these languages. In some cases it may be necessary to make the -modules' admin UI's operate in more than one supported language, while in other -cases the backend admin interface can operate in a single language. - -

    -

  3. -A developer is writing a new module, and wants to make it easy for -someone to localize it. There should be a clear path to author the -module so that future developers can easily add support for other -locales. This would include support for creating resources such as -message catalogs, non-text assets such as graphics, and use of -templates which help to separate application logic from presentation. -

    -

-

- - -

Competitive Analysis

- -

-

-Other application servers: ATG Dyanmo, Broadvision, Vignette, ... ? Anyone -know how they deal with i18n ? - -

- -

V. Related Links

- - - - - - - - - -

VI Requirements

- -Because the requirements for globalization affect many areas of the -system, we will break up the requirements into phases, with a base -required set of features, and then stages of increasing functionality. -

- - -

VI.A Locales

-10.0 A standard representation of locale will be used throughout the -system. A locale refers to a language and territory, and is uniquely -identified by a combination of ISO language and ISO country abbreviations. -

-

-See Content Repository Requirement 100.20 -

-10.10 Provide a consistent representation and API for creating and referencing a locale -

- -10.20 There will be a Tcl library of locale-aware formatting -and parsing functions for numbers, dates and times. Note that Java -has builtin support for these already. - -

-10.30 For each locale there will be default date, number and currency formats. -

- -

- -

VI.B Associating a Locale with a Request

- -20.0 The request processor must have a mechanism for associating a -locale with each request. This locale is then used to select the -appropriate template for a request, and will also be passed as the -locale argument to the message catalog or locale-specific formatting -functions. - -
-

-20.10 The locale for a request should be computed by the following method, in descending -order of priority: -

-

  • get locale associated with subsite or package id -
  • get locale from user preference -
  • get locale from site wide default -

    - -20.20 An API will be provided for getting the current request locale from -the ad_conn structure. - -

  • -

    VI.C Resource Bundles / Content Repository

    - -30.0 A mechanism must be provided for a developer to group a set of -arbitrary content resources together, keyed by a unique identifier and -a locale. - -

    -For example, what approaches could be used to implement a localizable -nav-bar mechanism for a site? A navigation bar might be made up of a -set of text strings and graphics, where the graphics themselves are -locale-specific, such as images of English or Japanese text (as on -www.arsdigita.com). It should be easy to specify alternate -configurations of text and graphics to lay out the page for different -locales. -

    -Design note: Alternative mechanisms to implement this functionality -might include using templates, Java ResourceBundles, content-item -containers in the Content Repository, or some convention assigning a -common prefix to key strings in the message catalog. - -

    - -

    VI.D Message Catalog for String Translation

    - -40.0 A message catalog facility will provide a database of translations for -constant strings for multilingual applications. It must support the -following: - -
    - -

    -40.10 Each message will referenced via unique a key. - -

    - -40.20 The key for a message will have some hierarchical structure to it, -so that sets of messages can be grouped with respect to a module name -or package path. - -

    - -40.30 The API for lookup of a message will take a locale and message key as -arguments, and return the appropriate translation of that message for -the specifed locale. - -

    -40.40 The API for lookup of a message will accept an optional default string -which can be used if the message key is not found in the catalog. This -lets the developer get code working and tested in a single -language before having to initialize or update a message catalog. - -

    - - -40.50 For use within templates, custom tags which invoke the message lookup -API will be provided. - -

    - -40.60 Provide a method for importing and exporting a flat file of -translation strings, in order to make it as easy as possible to create -and modify message translations in bulk without having to use a web -interface. - -

    -40.70 Since translations may be in different character sets, there must -be provision for writing and reading catalog files in different -character sets. A mechanism must exist for identifying the character -set of a catalog file before reading it. - -

    -40.80 There should be a mechanism for tracking dependencies in the message -catalog, so that if a string is modified, the other translations of -that string can be flagged as needing update. - -

    -40.90 The message lookup must be as efficient as possible so as not to slow -down the delivery of pages. - -

    - -
    -Design question: Is there any reason to implement the message catalog on top of the content repository as -the underlying storage and retrieval service, with a layer of caching for -performance? Would we get a nice user interface and version control -almost for free? - - - -

    -

    VI.E Character Set Encoding

    - -Character Sets -

    -50.0 A locale will have a primary associated character set -which is used to encode text in the language. When given a locale, we -can query the system for the associated character set to use. -

    -The assumption is that we are going to use Unicode in our database to -hold all text data. Our current programming environments (Tcl/Oracle -or Java/Oracle) operate on Unicode data internally. However, since -Unicode is not yet commonly used in browsers and authoring tools, the -system must be able to read and write other character sets. In -particular, conversions to and from Unicode will need to be explicitly -performed at the following times: - -

      -
    • Loading source files (.tcl or .adp) or content files from the -filesystem - -
    • Accepting form input data from users -
    • Delivering -text output to a browser - -
    • Composing an email message - -
    • Writing -data to the filesystem -
    - -

    -
    Design question: Do we want to mandate that all template files -be stored in UTF8? I don't think so, because most people don't have Unicode -editors, or don't want to be bothered with an extra step to convert -files to UTF8 and back when editing them in their favorite editor. -

    -Same question for script and template files, how do we know what -language and character set they are authored in? Should we overload -the filename suffix (e.g., '.shiftjis.adp', '.ja_JP.euc.adp')? -

    -The simplest design is probably just to assign a default mapping from -each locale to character a set: e.g. ja_JP -> ShiftJIS, fr_FR -> -ISO-8859-1. +++ (see new ACS/Java notes) +++ - - -

    - -

    -

    Tcl Source File Character Set

    - -There are two classes of Tcl files loaded by the system; library files -loaded at server startup, and page script files, which are run on -each page request. - -

    -
    Should we require all Tcl files be stored as UTF8? That -seems too much of a burden on developers. - -

    -50.10 Tcl library files can be authored in any character set. The system -must have a way to determine the character set before loading the files, probably from the filename. -

    -50.20 Tcl page script files can be authored in any character set. The system -must have a way to determine the character set before loading the files, probably from the filename. -

    - -

    Submitted Form Data Character Set

    - -50.30 Data which is submitted with a HTTP request using a GET or POST -method may be in any character set. The system must be able -to determine the encoding of the form data and convert it -to Unicode on demand. - -

    -50.35 The developer must be able to override the default system -choice of character set when parsing and validating user form data. - -

    -50.30.10 Extra hair: In Japan and some other Asian languages where there are multiple -character set encodings in common use, the server may need to attempt to -do an auto-detection of the character set, because buggy browsers may submit -form data in an unexpected alternate encoding. - - -

    -

    Output Character Set

    - -50.40 The output character set for a page request will be determined by default by the -locale associated with the request (see requirement 20.0). - -

    -50.50 It must be possible for a developer to manually override the output -character set encoding for a request using an API function. -

    - -

    - -

    VI.F ACS Kernel Issues

    - - -
    -60.10 All ACS error messages must use the message catalog and the request locale -to generate error message for the appropriate locale. -

    -60.20 Web server error messages such as 404, 500, etc must also be delivered -in the appropriate locale. -

    -60.30 Where files are written or read from disk, their filenames must use a -character set and character values which are safe for the underlying -operating system. -

    - -
    - -

    VI.G Templates

    - - -
    - -70.0 For a given abstract URL, the designer may create multiple locale-specific template files may be created (one per locale or language) -

    -70.10 For a given page request, the system must be able to select -an approprate locale-specific template file to use. -The request locale is computed as per (see requirement 20.0). - -

    Design note: this would probably be implemented -by suffixing the locale or a locale abbreviation to the template filename, such as foo.ja.adp or foo.en_GB.adp. - -

    - -

    -70.20A template file may be created for a partial locale (language only, without -a territory), and the request processor should be able to find the closest match for -the current request locale. - -

    - -70.30 A template file may be created in any character set. The system must have a -way to know which character set a template file contains, so it can -properly process it. -

    - - -

    Formatting Datasource Output in Templates

    - -70.50 The properties of a datasource column may include a datatype so that -the templating system can format the output for the current -locale. The datatype is defined by a standard ACS datatype plus a -format token or format string, for example: a date column might be -specified as 'current_date:date LONG,' or 'current_date:date -"YYYY-Mon-DD"' -

    -

    Forms

    - -70.60 The forms API must support construction of locale-specific HTML form -widgets, such as date entry widgets, and form validation of user input -data for locale-specific data, such as dates or numbers. - -

    - -70.70 For forms which allow users to upload files, a standard -method for a user to indicate the charset of a text file being -uploaded must be provided. - -

    Design note: -this presumably applies to uploading data to the content repository as -well -

    - - -

    -

    VI.H Sorting and Searching

    - - -
    -80.10 Support API for correct collation (sorting order) on lists of strings in locale-dependent way. - -

    - -80.20 For the Tcl API, we will say that locale-dependent sorting will use Oracle SQL -operations (i.e., we won't provide a Tcl API for this). We require -a Tcl API function to return the correct incantation of NLS_SORT to use -for a given locale with ORDER BY clauses in queries. - -

    -80.40 The system must handle full-text search in any supported language. - - -

    -

    VI.G Time Zones

    - -
    -90.10 Provide API support for specifying a time zone -

    - -90.20 Provide an API for computing time and date operations which are aware -of timezones. So for example a calendar module can properly -synchronize items inserted into a calendar from users in different -time zones using their own local times. - -

    -90.30 Store all dates and times in universal time zone, UTC. - -

    - -90.40 For a registered users, a time zone preference should be stored. -

    - -90.50 For a non-registered user a time zone preference should -be attached via a session or else UTC should be used to display -every date and time. -

    - -90.60 The default if we can't determine a time zone is to display - - all dates and times in some universal time zone such as GMT. - -

    - - -

    -

    VI.H Database

    - -
    - -

    -100.10 Since UTF8 strings can use up to three (UCS2) or six (UCS4) bytes -per character, make sure that column size declarations in the schema -are large enough to accomodate required data (such as email addresses -in Japanese). - -

    - -

    -

    VI.I Email and Messaging

    - -When sending an email message, just as when delivering the content in -web page over an HTTP connection, it is necessary to be able to -specify what character set encoding to use. - - -
    - -

    -110.10 The email message sending API will allow for a character set encoding to be specified. -

    -110.20 The email accepting API will allow for character set to be parsed correctly (hopefully -a well formatted message will have a MIME character set content type header) - -

    - - -

    Implementation Notes

    - -Because globalization touches many different parts of the system, -we want to reduce the implementation risk by breaking the implementation -into phases. - -

    - - -

    VII. Revision History

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Document Revision #Action Taken, NotesWhen?By Whom?
    0.1Creation11/08/2000Henry Minsky
    0.2Minor typos fixed, clarifications to wording11/14/2000Henry Minsky
    0.3comments from Christian1/14/2000Henry Minsky
    - - -
    - -
    - hqm@arsdigita.com -
    - -

    Last modified: $Date$

    - - + + + + + + + +ACS 4 Globalization Requirements + + +

    ACS 4 Globalization Requirements

    +

    by Henry Minsky, Yon Feldman, Lars Pind, others

    +
    +

    I. Introduction

    +This document describes the requirements for functionality in the +ACS platform to support globalization of the core and optional +modules. The goal is to make it possible to support delivery of +applications which work properly in multiple locales with the +lowest development and maintenance cost. +

    Definitions

    +
    internationalization (i18n) +

    The provision within a computer program of the capability of +making itself adaptable to the requirements of different native +languages, local customs and coded character sets.

    +

    locale

    +

    The definition of the subset of a user's environment that +depends on language and cultural conventions.

    +

    localization (L10n)

    +

    The process of establishing information within a computer system +specific to the operation of particular native languages, local +customs and coded character sets.

    +

    globalization

    +

    A product development approach which ensures that software +products are usable in the worldwide markets through a combination +of internationalization and localization.

    +
    +

    II. Vision Statement

    +The Mozilla project suggests keeping two catchy phrases in mind +when thinking about globalization: +
      +
    • One code base for the world
    • +
    • English is just another language
    • +
    +

    Building an application often involves making a number of +assumptions on the part of the developers which depend on their own +culture. These include constant strings in the user interface and +system error messages, names of countries, cities, order of given +and family names for people, syntax of numeric and date strings and +collation order of strings.

    +

    The ACS should be able to operate in languages and regions +beyond US English. The goal of ACS Globalization is to provide a +clean and efficient way to factor out the locale dependent +functionality from our applications, in order to be able to easily +swap in alternate localizations.

    +

    This in turn will reduce redundant, costly, and error prone +rework when targeting the toolkit or applications built with the +toolkit to another locale.

    +

    The cost of porting the ACS to another locale without some kind +of globalization support would be large and ongoing, since without +a mechanism to incorporate the locale-specific changes cleanly back +into the code base, it would require making a new fork of the +source code for each locale.

    +

    III. System/Application Overview

    +A globalized application will perform some or all of the following +steps to handle a page request for a specific locale: +
      +
    1. Decide what the target locale is for an incoming page +request
    2. +
    3. Decide which character set encoding the output should be +delivered in
    4. +
    5. If a script file to handle the request needs to be loaded from +disk, determine if a character set conversion needs to be performed +when loading the script
      +
    6. +
    7. If needed, locale-specific resources are fetched. These can +include text, graphics, or other resources that would vary with the +target locale.
    8. +
    9. If content data is fetched from the database, check for +locale-specific versions of the data (e.g. country names).
    10. +
    11. Source code should use a message catalog API to translate +constant strings in the code to the target locale
    12. +
    13. Perform locale-specific linguistic sorting on data if +needed
    14. +
    15. If the user submitted form input data, decide what character +set encoding conversion if any is needed. Parse locale-specific +quantities if needed (number formats, date formats).
    16. +
    17. If templating is being used, select correct locale-specific +template to merge with content
    18. +
    19. Format output data quantities in locale-specific manner (date, +time, numeric, currency). If templating is being used, this may be +done either before and/or after merging the data with a +template.
    20. +
    +

    Since the internationalization APIs may potentially be used on +every page in an application, the overhead for adding +internationalization to a module or application must not cause a +significant time delay in handling page requests.

    +

    In many cases there are facilities in Oracle to perform various +localization functions, and also there are facilities in Java which +we will want to move to. So the design to meet the requirements +will tend to rely on these capabilities, or close approximations to +them where possible, in order to make it easier to maintain Tcl and +Java ACS versions.

    +

    IV. Use-cases and User-scenarios

    +Here are the cases that we need to be able to handle efficiently: +
      +
    1. A developer needs to author a web site/application in a +language besides English, and possibly a character set besides +ISO-8859-1. This includes the operation of the ACS itself, i.e., +navigation, admin pages for modules, error messages, as well as +additional modules or content supplied by the web site developer. +

      What do they need to modify to make this work? Can their +localization work be easily folded in to future releases of +ACS?

      +
    2. +
    3. A developer needs to author a web site which operates in +multiple languages simultaneously. For example, arsDigita.com with +content and navigation in English, German, and Japanese. +

      The site would have an end-user visible UI to support these +languages, and the content management system must allow articles to +be posted in these languages. In some cases it may be necessary to +make the modules' admin UI's operate in more than one supported +language, while in other cases the backend admin interface can +operate in a single language.

      +
    4. +
    5. A developer is writing a new module, and wants to make it easy +for someone to localize it. There should be a clear path to author +the module so that future developers can easily add support for +other locales. This would include support for creating resources +such as message catalogs, non-text assets such as graphics, and use +of templates which help to separate application logic from +presentation.
    6. +
    +

    Competitive Analysis

    +

    Other application servers: ATG Dyanmo, Broadvision, Vignette, +... ? Anyone know how they deal with i18n ?

    +

    V. Related Links

    + +

    VI Requirements

    +Because the requirements for globalization affect many areas of the +system, we will break up the requirements into phases, with a base +required set of features, and then stages of increasing +functionality. +

    VI.A Locales

    +10.0 A standard representation of locale will be used +throughout the system. A locale refers to a language and territory, +and is uniquely identified by a combination of ISO language and ISO +country abbreviations. +
    See +Content Repository Requirement 100.20 +

    10.10 Provide a consistent representation and API for +creating and referencing a locale

    +

    10.20 There will be a Tcl library of locale-aware +formatting and parsing functions for numbers, dates and times. +Note that Java has builtin support for these already.

    +

    10.30 For each locale there will be default date, number +and currency formats.

    +
    +

    VI.B Associating a Locale with a Request

    +20.0 The request processor must have a mechanism for +associating a locale with each request. This locale is then used to +select the appropriate template for a request, and will also be +passed as the locale argument to the message catalog or +locale-specific formatting functions. +
    +

    20.10 The locale for a request should be computed by the +following method, in descending order of priority:

    +
      +
    • get locale associated with subsite or package id
    • +
    • get locale from user preference
    • +
    • get locale from site wide default +

      20.20 An API will be provided for getting the current +request locale from the ad_conn structure.

      +
    • +
    +
    +

    VI.C Resource Bundles / Content Repository

    +30.0 A mechanism must be provided for a developer to group a +set of arbitrary content resources together, keyed by a unique +identifier and a locale. +

    For example, what approaches could be used to implement a +localizable nav-bar mechanism for a site? A navigation bar might be +made up of a set of text strings and graphics, where the graphics +themselves are locale-specific, such as images of English or +Japanese text (as on www.arsdigita.com). It should be easy to +specify alternate configurations of text and graphics to lay out +the page for different locales.

    +

    Design note: Alternative mechanisms to implement this +functionality might include using templates, Java ResourceBundles, +content-item containers in the Content Repository, or some +convention assigning a common prefix to key strings in the message +catalog.

    +

    VI.D Message Catalog for String Translation

    +40.0 A message catalog facility will provide a database of +translations for constant strings for multilingual applications. It +must support the following: +
    +

    40.10 Each message will referenced via unique a key.

    +

    40.20 The key for a message will have some hierarchical +structure to it, so that sets of messages can be grouped with +respect to a module name or package path.

    +

    40.30 The API for lookup of a message will take a locale +and message key as arguments, and return the appropriate +translation of that message for the specifed locale.

    +

    40.40 The API for lookup of a message will accept an +optional default string which can be used if the message key is not +found in the catalog. This lets the developer get code working and +tested in a single language before having to initialize or update a +message catalog.

    +

    40.50 For use within templates, custom tags which invoke +the message lookup API will be provided.

    +

    40.60 Provide a method for importing and exporting a flat +file of translation strings, in order to make it as easy as +possible to create and modify message translations in bulk without +having to use a web interface.

    +

    40.70 Since translations may be in different character +sets, there must be provision for writing and reading catalog files +in different character sets. A mechanism must exist for identifying +the character set of a catalog file before reading it.

    +

    40.80 There should be a mechanism for tracking +dependencies in the message catalog, so that if a string is +modified, the other translations of that string can be flagged as +needing update.

    +

    40.90 The message lookup must be as efficient as possible +so as not to slow down the delivery of pages.

    +


    +Design question: Is there any reason to +implement the message catalog on top of the content repository as +the underlying storage and retrieval service, with a layer of +caching for performance? Would we get a nice user interface and +version control almost for free?

    +
    +

    VI.E Character Set Encoding

    +Character Sets +

    50.0 A locale will have a primary associated character +set which is used to encode text in the language. When given a +locale, we can query the system for the associated character set to +use.

    +

    The assumption is that we are going to use Unicode in our +database to hold all text data. Our current programming +environments (Tcl/Oracle or Java/Oracle) operate on Unicode data +internally. However, since Unicode is not yet commonly used in +browsers and authoring tools, the system must be able to read and +write other character sets. In particular, conversions to and from +Unicode will need to be explicitly performed at the following +times:

    +
      +
    • Loading source files (.tcl or .adp) or content files from the +filesystem
    • +
    • Accepting form input data from users
    • +
    • Delivering text output to a browser
    • +
    • Composing an email message
    • +
    • Writing data to the filesystem
    • +
    +


    +Design question: Do we want to mandate +that all template files be stored in UTF8? I don't think so, +because most people don't have Unicode editors, or don't want to be +bothered with an extra step to convert files to UTF8 and back when +editing them in their favorite editor.

    +

    Same question for script and template +files, how do we know what language and character set they are +authored in? Should we overload the filename suffix (e.g., +'.shiftjis.adp', '.ja_JP.euc.adp')?

    +

    The simplest design is probably just to +assign a default mapping from each locale to character a set: e.g. +ja_JP -> ShiftJIS, fr_FR -> ISO-8859-1. +++ (see new ACS/Java +notes) +++

    +
    +

    Tcl Source File Character Set

    +There are two classes of Tcl files loaded by the system; library +files loaded at server startup, and page script files, which are +run on each page request. +


    +Should we require all Tcl files be stored +as UTF8? That seems too much of a burden on +developers.

    +

    50.10 Tcl library files can be authored in any character +set. The system must have a way to determine the character set +before loading the files, probably from the filename.

    +

    50.20 Tcl page script files can be authored in any +character set. The system must have a way to determine the +character set before loading the files, probably from the +filename.

    +

    Submitted Form Data Character Set

    +50.30 Data which is submitted with a HTTP request using a +GET or POST method may be in any character set. The system must be +able to determine the encoding of the form data and convert it to +Unicode on demand. +

    50.35 The developer must be able to override the default +system choice of character set when parsing and validating user +form data.

    +

    50.30.10 Extra hair: In Japan and some other Asian +languages where there are multiple character set encodings in +common use, the server may need to attempt to do an auto-detection +of the character set, because buggy browsers may submit form data +in an unexpected alternate encoding.

    +

    Output Character Set

    +50.40 The output character set for a page request will be +determined by default by the locale associated with the request +(see requirement 20.0). +

    50.50 It must be possible for a developer to manually +override the output character set encoding for a request using an +API function.

    +
    +

    VI.F ACS Kernel Issues

    +
    60.10 All ACS error messages must use the +message catalog and the request locale to generate error message +for the appropriate locale. +

    60.20 Web server error messages such as 404, 500, etc +must also be delivered in the appropriate locale.

    +

    60.30 Where files are written or read from disk, their +filenames must use a character set and character values which are +safe for the underlying operating system.

    +
    +

    VI.G Templates

    +
    70.0 For a given abstract URL, the designer may +create multiple locale-specific template files may be created (one +per locale or language) +

    70.10 For a given page request, the system must be able +to select an approprate locale-specific template file to use. The +request locale is computed as per (see requirement 20.0).

    +

    Design note: this would probably be +implemented by suffixing the locale or a locale abbreviation to the +template filename, such as foo.ja.adp or +foo.en_GB.adp.

    +

    70.20A template file may be created for a partial locale +(language only, without a territory), and the request processor +should be able to find the closest match for the current request +locale.

    +

    70.30 A template file may be created in any character +set. The system must have a way to know which character set a +template file contains, so it can properly process it.

    +

    Formatting Datasource Output in Templates

    +70.50 The properties of a datasource column may include a +datatype so that the templating system can format the output for +the current locale. The datatype is defined by a standard ACS +datatype plus a format token or format string, for example: a date +column might be specified as 'current_date:date LONG,' or +'current_date:date "YYYY-Mon-DD"' +

    Forms

    +70.60 The forms API must support construction of +locale-specific HTML form widgets, such as date entry widgets, and +form validation of user input data for locale-specific data, such +as dates or numbers. +

    70.70 For forms which allow users to upload files, a +standard method for a user to indicate the charset of a text file +being uploaded must be provided.

    +

    Design note: this presumably applies to +uploading data to the content repository as well

    +
    +

    VI.H Sorting and Searching

    +
    80.10 Support API for correct collation (sorting +order) on lists of strings in locale-dependent way. +

    80.20 For the Tcl API, we will say that locale-dependent +sorting will use Oracle SQL operations (i.e., we won't provide a +Tcl API for this). We require a Tcl API function to return the +correct incantation of NLS_SORT to use for a given locale with +ORDER BY clauses in queries.

    +

    80.40 The system must handle full-text search in any +supported language.

    +
    +

    VI.G Time Zones

    +
    90.10 Provide API support for specifying a time +zone +

    90.20 Provide an API for computing time and date +operations which are aware of timezones. So for example a calendar +module can properly synchronize items inserted into a calendar from +users in different time zones using their own local times.

    +

    90.30 Store all dates and times in universal time zone, +UTC.

    +

    90.40 For a registered users, a time zone preference +should be stored.

    +

    90.50 For a non-registered user a time zone preference +should be attached via a session or else UTC should be used to +display every date and time.

    +

    90.60 The default if we can't determine a time zone is to +display all dates and times in some universal time zone such as +GMT.

    +
    +

    VI.H Database

    +
    +

    100.10 Since UTF8 strings can use up to three (UCS2) or +six (UCS4) bytes per character, make sure that column size +declarations in the schema are large enough to accomodate required +data (such as email addresses in Japanese).

    +
    +

    VI.I Email and Messaging

    +When sending an email message, just as when delivering the content +in web page over an HTTP connection, it is necessary to be able to +specify what character set encoding to use. +
    +

    110.10 The email message sending API will allow for a +character set encoding to be specified.

    +

    110.20 The email accepting API will allow for character +set to be parsed correctly (hopefully a well formatted message will +have a MIME character set content type header)

    +
    +

    Implementation Notes

    +Because globalization touches many different parts of the system, +we want to reduce the implementation risk by breaking the +implementation into phases. +

    VII. Revision History

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Document Revision #Action Taken, NotesWhen?By Whom?
    0.1Creation11/08/2000Henry Minsky
    0.2Minor typos fixed, clarifications to +wording11/14/2000Henry Minsky
    0.3comments from Christian1/14/2000Henry Minsky
    +
    +
    hqm@arsdigita.com
    +

    Last modified: $Date$

    + +