[activescaffoldlocalize commit] r92 - in trunk: . lang lib/extensions

0 views
Skip to first unread message

codesite...@google.com

unread,
Dec 28, 2007, 4:35:18 PM12/28/07
to activescaffold...@googlegroups.com
Author: edwin.moss
Date: Fri Dec 28 13:34:59 2007
New Revision: 92

Added:
trunk/lib/extensions/form_options_helper.rb
Modified:
trunk/environment.rb
trunk/lang/en-us.rb
trunk/lang/fr-ca.rb

Log:
Add country localization - always store english in DB.

Modified: trunk/environment.rb
==============================================================================
--- trunk/environment.rb (original)
+++ trunk/environment.rb Fri Dec 28 13:34:59 2007
@@ -1,6 +1,7 @@
require 'localization'

require "#{File.dirname __FILE__}/lib/extensions/active_record"
+require "#{File.dirname __FILE__}/lib/extensions/form_options_helper"
require "#{File.dirname __FILE__}/lib/helpers/list_column_helpers"

##

Modified: trunk/lang/en-us.rb
==============================================================================
--- trunk/lang/en-us.rb (original)
+++ trunk/lang/en-us.rb Fri Dec 28 13:34:59 2007
@@ -67,80 +67,326 @@
lang['There were problems with the following fields:'] ||= 'There
were problems with the following fields:'

# Dates
- lang[:date_helper] = {
- :calendar_help => "yyyy-mm-dd or use calendar",
- :calendar_tool_tip => 'Click to Show Calendar
- or try these Shortcuts:
- today (tod)
- tomorrow (tom)
- yesterday
- 6 (6th or 6th October)
- 3rd of Feb
- 12 feb
- mon
- next mon
- last mon
- 4/26',
- # don't translate, just re-order
- :date_helper_date_formats => {
- :default => "%Y-%m-%d",
- :short => "%b %e",
- :long => "%B %e, %Y"
- },
- # don't translate, just re-order
- :date_helper_time_formats => {
- :default => "%a, %d %b %Y %H:%M:%S %z",
- :short => "%d %b %H:%M",
- :long => "%B %d, %Y %H:%M"
- },
- # added at the end of date if your date system doesn't use a 24
hours system
- :date_helper_am => 'am',
- :date_helper_pm => 'pm',
- :date_helper_month_names => ['',
- 'January',
- 'February',
- 'March',
- 'April',
- 'May',
- 'June',
- 'July',
- 'August',
- 'September',
- 'October',
- 'November',
- 'December'],
+ lang[:date_helper] = {
+ :calendar_help => "yyyy-mm-dd or use calendar",
+ :calendar_tool_tip => 'Click to Show Calendar
+or try these Shortcuts:
+today (tod)
+tomorrow (tom)
+yesterday
+6 (6th or 6th October)
+3rd of Feb
+12 feb
+mon
+next mon
+last mon
+4/26',
+ # don't translate, just re-order
+ :date_helper_date_formats => {
+ :default => "%Y-%m-%d",
+ :short => "%b %e",
+ :long => "%B %e, %Y"
+ },
+ # don't translate, just re-order
+ :date_helper_time_formats => {
+ :default => "%a, %d %b %Y %H:%M:%S %z",
+ :short => "%d %b %H:%M",
+ :long => "%B %d, %Y %H:%M"
+ },
+ # added at the end of date if your date system doesn't use a 24
hours system
+ :date_helper_am => 'am',
+ :date_helper_pm => 'pm',
+ :date_helper_month_names => ['',
+ 'January',
+ 'February',
+ 'March',
+ 'April',
+ 'May',
+ 'June',
+ 'July',
+ 'August',
+ 'September',
+ 'October',
+ 'November',
+ 'December'],

- :date_helper_abbr_month_names => ['',
- 'Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec'],
+ :date_helper_abbr_month_names => ['',
+ 'Jan',
+ 'Feb',
+ 'Mar',
+ 'Apr',
+ 'May',
+ 'Jun',
+ 'Jul',
+ 'Aug',
+ 'Sep',
+ 'Oct',
+ 'Nov',
+ 'Dec'],

- :date_helper_day_names => [
- 'Sunday',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday'],
-
- :date_helper_abbr_day_names => [
- 'Sun',
- 'Mon',
- 'Tue',
- 'Wed',
- 'Thu',
- 'Fri',
- 'Sat']
- }
+ :date_helper_day_names => [
+ 'Sunday',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday'],

+ :date_helper_abbr_day_names => [
+ 'Sun',
+ 'Mon',
+ 'Tue',
+ 'Wed',
+ 'Thu',
+ 'Fri',
+ 'Sat']
+ }
+
+ lang[:countries_list] = [
+ "Afghanistan",
+ "Albania",
+ "Algeria",
+ "American Samoa",
+ "Andorra",
+ "Angola",
+ "Anguilla",
+ "Antarctica",
+ "Antigua And Barbuda",
+ "Argentina",
+ "Armenia",
+ "Aruba",
+ "Australia",
+ "Austria",
+ "Azerbaijan",
+ "Bahamas",
+ "Bahrain",
+ "Bangladesh",
+ "Barbados",
+ "Belarus ",
+ "Belgium",
+ "Belize",
+ "Benin",
+ "Bermuda",
+ "Bhutan",
+ "Bolivia",
+ "Bosnia and Herzegowina",
+ "Botswana",
+ "Bouvet Island",
+ "Brazil",
+ "British Indian Ocean Territory ",
+ "Brunei Darussalam",
+ "Bulgaria",
+ "Burkina Faso",
+ "Burma",
+ "Burundi",
+ "Cambodia",
+ "Cameroon",
+ "Canada",
+ "Cape Verde",
+ "Cayman Islands",
+ "Central African Republic",
+ "Chad",
+ "Chile",
+ "China",
+ "Christmas Island",
+ "Cocos (Keeling) Islands",
+ "Colombia",
+ "Comoros",
+ "Congo",
+ "Congo, the Democratic Republic of the",
+ "Cook Islands",
+ "Costa Rica",
+ "Cote d'Ivoire",
+ "Croatia",
+ "Cuba",
+ "Cyprus",
+ "Czech Republic",
+ "Denmark",
+ "Djibouti",
+ "Dominica",
+ "Dominican Republic",
+ "East Timor",
+ "Ecuador",
+ "Egypt",
+ "El Salvador",
+ "England",
+ "Equatorial Guinea",
+ "Eritrea",
+ "Espana",
+ "Estonia",
+ "Ethiopia",
+ "Falkland Islands",
+ "Faroe Islands",
+ "Fiji",
+ "Finland",
+ "France",
+ "French Guiana",
+ "French Polynesia",
+ "French Southern Territories",
+ "Gabon",
+ "Gambia ",
+ "Georgia",
+ "Germany",
+ "Ghana",
+ "Gibraltar",
+ "Great Britain",
+ "Greece",
+ "Greenland",
+ "Grenada",
+ "Guadeloupe",
+ "Guam",
+ "Guatemala",
+ "Guinea",
+ "Guinea-Bissau",
+ "Guyana",
+ "Haiti",
+ "Heard and Mc Donald Islands",
+ "Honduras",
+ "Hong Kong",
+ "Hungary",
+ "Iceland ",
+ "India",
+ "Indonesia",
+ "Ireland",
+ "Israel",
+ "Italy",
+ "Iran",
+ "Iraq",
+ "Jamaica",
+ "Japan",
+ "Jordan",
+ "Kazakhstan",
+ "Kenya",
+ "Kiribati",
+ "Korea, Republic of",
+ "Korea (South)",
+ "Kuwait",
+ "Kyrgyzstan",
+ "Lao People's Democratic Republic",
+ "Latvia",
+ "Lebanon",
+ "Lesotho",
+ "Liberia",
+ "Liechtenstein",
+ "Lithuania",
+ "Luxembourg",
+ "Macau",
+ "Macedonia",
+ "Madagascar",
+ "Malawi",
+ "Malaysia",
+ "Maldives",
+ "Mali",
+ "Malta",
+ "Marshall Islands",
+ "Martinique",
+ "Mauritania",
+ "Mauritius",
+ "Mayotte",
+ "Mexico",
+ "Micronesia, Federated States of",
+ "Moldova, Republic of",
+ "Monaco",
+ "Mongolia",
+ "Montserrat",
+ "Morocco",
+ "Mozambique",
+ "Myanmar",
+ "Namibia",
+ "Nauru",
+ "Nepal",
+ "Netherlands",
+ "Netherlands Antilles",
+ "New Caledonia",
+ "New Zealand",
+ "Nicaragua",
+ "Niger",
+ "Nigeria",
+ "Niue",
+ "Norfolk Island",
+ "Northern Ireland",
+ "Northern Mariana Islands",
+ "Norway",
+ "Oman",
+ "Pakistan",
+ "Palau",
+ "Panama",
+ "Papua New Guinea",
+ "Paraguay",
+ "Peru",
+ "Philippines",
+ "Pitcairn",
+ "Poland",
+ "Portugal",
+ "Puerto Rico",
+ "Qatar",
+ "Reunion",
+ "Romania",
+ "Russia",
+ "Rwanda",
+ "Saint Kitts and Nevis",
+ "Saint Lucia",
+ "Saint Vincent and the Grenadines",
+ "Samoa (Independent)",
+ "San Marino",
+ "Sao Tome and Principe",
+ "Saudi Arabia",
+ "Scotland",
+ "Senegal",
+ "Serbia and Montenegro",
+ "Seychelles",
+ "Sierra Leone",
+ "Singapore",
+ "Slovakia",
+ "Slovenia",
+ "Solomon Islands",
+ "Somalia",
+ "South Africa",
+ "South Georgia and the South Sandwich Islands",
+ "South Korea",
+ "Spain",
+ "Sri Lanka",
+ "St. Helena",
+ "St. Pierre and Miquelon",
+ "Suriname",
+ "Svalbard and Jan Mayen Islands",
+ "Swaziland",
+ "Sweden",
+ "Switzerland",
+ "Taiwan",
+ "Tajikistan",
+ "Tanzania",
+ "Thailand",
+ "Togo",
+ "Tokelau",
+ "Tonga",
+ "Trinidad",
+ "Trinidad and Tobago",
+ "Tunisia",
+ "Turkey",
+ "Turkmenistan",
+ "Turks and Caicos Islands",
+ "Tuvalu",
+ "Uganda",
+ "Ukraine",
+ "United Arab Emirates",
+ "United Kingdom",
+ "United States",
+ "United States Minor Outlying Islands",
+ "Uruguay",
+ "Uzbekistan",
+ "Vanuatu",
+ "Vatican City State (Holy See)",
+ "Venezuela",
+ "Viet Nam",
+ "Virgin Islands (British)",
+ "Virgin Islands (U.S.)",
+ "Wales",
+ "Wallis and Futuna Islands",
+ "Western Sahara",
+ "Yemen",
+ "Zambia",
+ "Zimbabwe"
+ ]
end

Modified: trunk/lang/fr-ca.rb
==============================================================================
--- trunk/lang/fr-ca.rb (original)
+++ trunk/lang/fr-ca.rb Fri Dec 28 13:34:59 2007
@@ -132,4 +132,250 @@
'Sam'],
}

+ lang[:countries_list] = [
+ ["Afghanistan", "Afghanistan"],
+ ["Albanie", "Albania"],
+ ["Algérie", "Algeria"],
+ ["Samoa Américaine", "American Samoa"],
+ ["Andorre", "Andorra"],
+ ["Angola", "Angola"],
+ ["Anguilla", "Anguilla"],
+ ["Antarctique", "Antarctica"],
+ ["Antigua And Barbuda", "Antigua And Barbuda"],
+ ["Argentina", "Argentina"],
+ ["Armenia", "Armenia"],
+ ["Aruba", "Aruba"],
+ ["Australia", "Australia"],
+ ["Austria", "Austria"],
+ ["Azerbaijan", "Azerbaijan"],
+ ["Bahamas", "Bahamas"],
+ ["Bahrain", "Bahrain"],
+ ["Bangladesh", "Bangladesh"],
+ ["Barbados", "Barbados"],
+ ["Belarus ", "Belarus "],
+ ["Belgium", "Belgium"],
+ ["Belize", "Belize"],
+ ["Benin", "Benin"],
+ ["Bermuda", "Bermuda"],
+ ["Bhutan", "Bhutan"],
+ ["Bolivia", "Bolivia"],
+ ["Bosnia and Herzegowina", "Bosnia and Herzegowina"],
+ ["Botswana", "Botswana"],
+ ["Bouvet Island", "Bouvet Island"],
+ ["Brazil", "Brazil"],
+ ["British Indian Ocean Territory ", "British Indian
Ocean Territory "],
+ ["Brunei Darussalam", "Brunei Darussalam"],
+ ["Bulgaria", "Bulgaria"],
+ ["Burkina Faso", "Burkina Faso"],
+ ["Burma", "Burma"],
+ ["Burundi", "Burundi"],
+ ["Cambodia", "Cambodia"],
+ ["Cameroon", "Cameroon"],
+ ["Canada", "Canada"],
+ ["Cape Verde", "Cape Verde"],
+ ["Cayman Islands", "Cayman Islands"],
+ ["Central African Republic", "Central African Republic"],
+ ["Chad", "Chad"],
+ ["Chile", "Chile"],
+ ["China", "China"],
+ ["Christmas Island", "Christmas Island"],
+ ["Cocos (Keeling) Islands", "Cocos (Keeling) Islands"],
+ ["Colombia", "Colombia"],
+ ["Comoros", "Comoros"],
+ ["Congo", "Congo"],
+ ["Congo, the Democratic Republic of the", "Congo, the
Democratic Republic of the"],
+ ["Cook Islands", "Cook Islands"],
+ ["Costa Rica", "Costa Rica"],
+ ["Cote d'Ivoire", "Cote d'Ivoire"],
+ ["Croatia", "Croatia"],
+ ["Cuba", "Cuba"],
+ ["Cyprus", "Cyprus"],
+ ["Czech Republic", "Czech Republic"],
+ ["Denmark", "Denmark"],
+ ["Djibouti", "Djibouti"],
+ ["Dominica", "Dominica"],
+ ["Dominican Republic", "Dominican Republic"],
+ ["East Timor", "East Timor"],
+ ["Ecuador", "Ecuador"],
+ ["Egypt", "Egypt"],
+ ["El Salvador", "El Salvador"],
+ ["England", "England"],
+ ["Equatorial Guinea", "Equatorial Guinea"],
+ ["Eritrea", "Eritrea"],
+ ["Espana", "Espana"],
+ ["Estonia", "Estonia"],
+ ["Ethiopia", "Ethiopia"],
+ ["Falkland Islands", "Falkland Islands"],
+ ["Faroe Islands", "Faroe Islands"],
+ ["Fiji", "Fiji"],
+ ["Finland", "Finland"],
+ ["France", "France"],
+ ["French Guiana", "French Guiana"],
+ ["French Polynesia", "French Polynesia"],
+ ["French Southern Territories", "French Southern Territories"],
+ ["Gabon", "Gabon"],
+ ["Gambia ", "Gambia "],
+ ["Georgia", "Georgia"],
+ ["Germany", "Germany"],
+ ["Ghana", "Ghana"],
+ ["Gibraltar", "Gibraltar"],
+ ["Great Britain", "Great Britain"],
+ ["Greece", "Greece"],
+ ["Greenland", "Greenland"],
+ ["Grenada", "Grenada"],
+ ["Guadeloupe", "Guadeloupe"],
+ ["Guam", "Guam"],
+ ["Guatemala", "Guatemala"],
+ ["Guinea", "Guinea"],
+ ["Guinea-Bissau", "Guinea-Bissau"],
+ ["Guyana", "Guyana"],
+ ["Haiti", "Haiti"],
+ ["Heard and Mc Donald Islands", "Heard and Mc
Donald Islands"],
+ ["Honduras", "Honduras"],
+ ["Hong Kong", "Hong Kong"],
+ ["Hungary", "Hungary"],
+ ["Iceland ", "Iceland "],
+ ["India", "India"],
+ ["Indonesia", "Indonesia"],
+ ["Ireland", "Ireland"],
+ ["Israel", "Israel"],
+ ["Italy", "Italy"],
+ ["Iran", "Iran"],
+ ["Iraq", "Iraq"],
+ ["Jamaica", "Jamaica"],
+ ["Japan", "Japan"],
+ ["Jordan", "Jordan"],
+ ["Kazakhstan", "Kazakhstan"],
+ ["Kenya", "Kenya"],
+ ["Kiribati", "Kiribati"],
+ ["Korea, Republic of", "Korea, Republic of"],
+ ["Korea (South)", "Korea (South)"],
+ ["Kuwait", "Kuwait"],
+ ["Kyrgyzstan", "Kyrgyzstan"],
+ ["Lao People's Democratic Republic", "Lao People's
Democratic Republic"],
+ ["Latvia", "Latvia"],
+ ["Lebanon", "Lebanon"],
+ ["Lesotho", "Lesotho"],
+ ["Liberia", "Liberia"],
+ ["Liechtenstein", "Liechtenstein"],
+ ["Lithuania", "Lithuania"],
+ ["Luxembourg", "Luxembourg"],
+ ["Macau", "Macau"],
+ ["Macedonia", "Macedonia"],
+ ["Madagascar", "Madagascar"],
+ ["Malawi", "Malawi"],
+ ["Malaysia", "Malaysia"],
+ ["Maldives", "Maldives"],
+ ["Mali", "Mali"],
+ ["Malta", "Malta"],
+ ["Marshall Islands", "Marshall Islands"],
+ ["Martinique", "Martinique"],
+ ["Mauritania", "Mauritania"],
+ ["Mauritius", "Mauritius"],
+ ["Mayotte", "Mayotte"],
+ ["Mexico", "Mexico"],
+ ["Micronesia, Federated States of", "Micronesia,
Federated States of"],
+ ["Moldova, Republic of", "Moldova,
Republic of"],
+ ["Monaco", "Monaco"],
+ ["Mongolia", "Mongolia"],
+ ["Montserrat", "Montserrat"],
+ ["Morocco", "Morocco"],
+ ["Mozambique", "Mozambique"],
+ ["Myanmar", "Myanmar"],
+ ["Namibia", "Namibia"],
+ ["Nauru", "Nauru"],
+ ["Nepal", "Nepal"],
+ ["Netherlands", "Netherlands"],
+ ["Netherlands Antilles", "Netherlands Antilles"],
+ ["New Caledonia", "New Caledonia"],
+ ["New Zealand", "New Zealand"],
+ ["Nicaragua", "Nicaragua"],
+ ["Niger", "Niger"],
+ ["Nigeria", "Nigeria"],
+ ["Niue", "Niue"],
+ ["Norfolk Island", "Norfolk Island"],
+ ["Northern Ireland", "Northern Ireland"],
+ ["Northern Mariana Islands", "Northern Mariana Islands"],
+ ["Norway", "Norway"],
+ ["Oman", "Oman"],
+ ["Pakistan", "Pakistan"],
+ ["Palau", "Palau"],
+ ["Panama", "Panama"],
+ ["Papua New Guinea", "Papua New Guinea"],
+ ["Paraguay", "Paraguay"],
+ ["Peru", "Peru"],
+ ["Philippines", "Philippines"],
+ ["Pitcairn", "Pitcairn"],
+ ["Poland", "Poland"],
+ ["Portugal", "Portugal"],
+ ["Puerto Rico", "Puerto Rico"],
+ ["Qatar", "Qatar"],
+ ["Reunion", "Reunion"],
+ ["Romania", "Romania"],
+ ["Russia", "Russia"],
+ ["Rwanda", "Rwanda"],
+ ["Saint Kitts and Nevis", "Saint Kitts and Nevis"],
+ ["Saint Lucia", "Saint Lucia"],
+ ["Saint Vincent and the Grenadines", "Saint Vincent
and the Grenadines"],
+ ["Samoa (Independent)", "Samoa (Independent)"],
+ ["San Marino", "San Marino"],
+ ["Sao Tome and Principe", "Sao Tome and Principe"],
+ ["Saudi Arabia", "Saudi Arabia"],
+ ["Scotland", "Scotland"],
+ ["Senegal", "Senegal"],
+ ["Serbia and Montenegro", "Serbia and Montenegro"],
+ ["Seychelles", "Seychelles"],
+ ["Sierra Leone", "Sierra Leone"],
+ ["Singapore", "Singapore"],
+ ["Slovakia", "Slovakia"],
+ ["Slovenia", "Slovenia"],
+ ["Solomon Islands", "Solomon Islands"],
+ ["Somalia", "Somalia"],
+ ["South Africa", "South Africa"],
+ ["South Georgia and the South Sandwich Islands", "South Georgia
and the South Sandwich Islands"],
+ ["South Korea", "South Korea"],
+ ["Spain", "Spain"],
+ ["Sri Lanka", "Sri Lanka"],
+ ["St. Helena", "St. Helena"],
+ ["St. Pierre and Miquelon", "St. Pierre and Miquelon"],
+ ["Suriname", "Suriname"],
+ ["Svalbard and Jan Mayen Islands", "Svalbard and Jan
Mayen Islands"],
+ ["Swaziland", "Swaziland"],
+ ["Sweden", "Sweden"],
+ ["Switzerland", "Switzerland"],
+ ["Taiwan", "Taiwan"],
+ ["Tajikistan", "Tajikistan"],
+ ["Tanzania", "Tanzania"],
+ ["Thailand", "Thailand"],
+ ["Togo", "Togo"],
+ ["Tokelau", "Tokelau"],
+ ["Tonga", "Tonga"],
+ ["Trinidad", "Trinidad"],
+ ["Trinidad and Tobago", "Trinidad and Tobago"],
+ ["Tunisia", "Tunisia"],
+ ["Turkey", "Turkey"],
+ ["Turkmenistan", "Turkmenistan"],
+ ["Turks and Caicos Islands", "Turks and Caicos Islands"],
+ ["Tuvalu", "Tuvalu"],
+ ["Uganda", "Uganda"],
+ ["Ukraine", "Ukraine"],
+ ["United Arab Emirates", "United Arab Emirates"],
+ ["United Kingdom", "United Kingdom"],
+ ["United States", "United States"],
+ ["United States Minor Outlying Islands", "United States
Minor Outlying Islands"],
+ ["Uruguay", "Uruguay"],
+ ["Uzbekistan", "Uzbekistan"],
+ ["Vanuatu", "Vanuatu"],
+ ["Vatican City State (Holy See)", "Vatican City
State (Holy See)"],
+ ["Venezuela", "Venezuela"],
+ ["Viet Nam", "Viet Nam"],
+ ["Virgin Islands (British)", "Virgin Islands (British)"],
+ ["Virgin Islands (U.S.)", "Virgin Islands (U.S.)"],
+ ["Wales", "Wales"],
+ ["Wallis and Futuna Islands", "Wallis and
Futuna Islands"],
+ ["Western Sahara", "Western Sahara"],
+ ["Yemen", "Yemen"],
+ ["Zambia", "Zambia"],
+ ["Zimbabwe" "Zimbabwe"]
+ ]
end

Added: trunk/lib/extensions/form_options_helper.rb
==============================================================================
--- (empty file)
+++ trunk/lib/extensions/form_options_helper.rb Fri Dec 28 13:34:59 2007
@@ -0,0 +1,25 @@
+module ActionView
+ module Helpers
+ module FormOptionsHelper
+
+ def country_options_for_select(selected = nil,
priority_countries = nil)
+ country_options = ""
+
+ if priority_countries
+ country_options += options_for_select(priority_countries, selected)
+ country_options += "<option value=\"\">-------------</option>\n"
+ end
+
+ if priority_countries && priority_countries.include?(selected)
+ country_options += options_for_select((__(:countries_list) ||
[]) - priority_countries, selected)
+ else
+ country_options += options_for_select((__(:countries_list) ||
[]), selected)
+ end
+
+ return country_options
+ end
+
+ end
+
+ end
+end

codesite...@google.com

unread,
Dec 28, 2007, 4:35:18 PM12/28/07
to activescaffold...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages