Compare commits

..

No commits in common. "0a58e2699e88b40dc1a6bf6a6e43f54f1e14e33b" and "57d513791350d6f9a22da5bd8e1dd8e4f3723293" have entirely different histories.

27 changed files with 35 additions and 1840 deletions

View File

@ -7,8 +7,8 @@ values (1, 'demo@numerus', 'Demo User', 'demo', 'invoicer')
, (2, 'admin@numerus', 'Demo Admin', 'admin', 'admin')
;
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country_code, currency_code)
values (1, 'Juli Verd', 'ES40404040D', 'Pesebre', parse_packed_phone_number('972 50 60 70', 'ES'), 'info@numerus.cat', 'https://numerus.cat/', 'C/ de lHort', 'Castelló dEmpúries', 'Alt Empordà', '17486', 'ES', 'EUR');
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country, currency_code)
values (1, 'Juli Verd', 'ES40404040D', 'Pesebre', parse_packed_phone_number('972 50 60 70', 'ES'), 'info@numerus.cat', 'https://numerus.cat/', 'C/ de lHort', 'Castelló dEmpúries', 'Alt Empordà', '17486', 'Espanya', 'EUR');
insert into company_user (company_id, user_id)
values (1, 1)

View File

@ -1,767 +0,0 @@
-- Deploy numerus:available_countries to pg
-- requires: schema_numerus
-- requires: country
-- requires: country_i18n
begin;
-- Downloaded from https://www.ecb.europa.eu/stats/money_credit_banking/anacredit/html/index.en.html
-- Last updated 2022-07-29.
-- Names come from Unicodes Common Locale Data Repository (CLDR).
insert into numerus.country
(country_code, name, postal_code_regex)
values ('AF', 'Afghanistan', '\d{4}')
, ('AX', 'Åland Islands', '.{1,255}')
, ('AL', 'Albania', '\d{4}')
, ('DZ', 'Algeria', '\d{5}')
, ('AS', 'American Samoa', '967\d{2}(-\d{4})?')
, ('AD', 'Andorra', 'AD\d{3}')
, ('AO', 'Angola', '.{1,255}')
, ('AI', 'Anguilla', '(AI-2640)')
, ('AQ', 'Antarctica', '(7151)')
, ('AG', 'Antigua and Barbuda', '.{1,255}')
, ('AR', 'Argentina', '([A-Z]\d{4}[A-Z]{3})|([A-Z]\d{4})')
, ('AM', 'Armenia', '(\d{4})|(\d{6})')
, ('AW', 'Aruba', '.{1,255}')
, ('AU', 'Australia', '\d{4}')
, ('AT', 'Austria', '\d{4}')
, ('AZ', 'Azerbaijan', '(AZ)(\d{4})|(AZ )(\d{4})')
, ('BS', 'Bahamas', '.{1,255}')
, ('BH', 'Bahrain', '\d{3}\d?')
, ('BD', 'Bangladesh', '\d{4}')
, ('BB', 'Barbados', 'BB\d{5}')
, ('BY', 'Belarus', '\d{6}')
, ('BE', 'Belgium', '\d{4}')
, ('PW', 'Belau', '(96939|96940)')
, ('BZ', 'Belize', '.{1,255}')
, ('BJ', 'Benin', '.{1,255}')
, ('BM', 'Bermuda', '[A-Z]{2} \d{2}')
, ('BT', 'Bhutan', '\d{5}')
, ('BO', 'Bolivia', '.{1,255}')
, ('BQ', 'Bonaire, Saint Eustatius and Saba', '.{1,255}')
, ('BA', 'Bosnia and Herzegovina', '\d{5}')
, ('BW', 'Botswana', '.{1,255}')
, ('BV', 'Bouvet Island', '.{1,255}')
, ('BR', 'Brazil', '[0-9]{5}-[0-9]{3}')
, ('IO', 'British Indian Ocean Territory', '(BB9D 1ZZ)')
, ('BN', 'Brunei', '[A-Z]{2}\d{4}')
, ('BG', 'Bulgaria', '\d{4}')
, ('BF', 'Burkina Faso', '[1-9]\d{4}')
, ('BI', 'Burundi', '.{1,255}')
, ('KH', 'Cambodia', '\d{5,6}')
, ('CM', 'Cameroon', '.{1,255}')
, ('CA', 'Canada', '[A-Z][0-9][A-Z] [0-9][A-Z][0-9]')
, ('CV', 'Cape Verde', '\d{4}')
, ('KY', 'Cayman Islands', '[K][Y][0-9]{1}[-]([0-9]){4}')
, ('CF', 'Central African Republic', '.{1,255}')
, ('TD', 'Chad', '.{1,255}')
, ('CL', 'Chile', '\d{7}')
, ('CN', 'China', '\d{6}')
, ('CX', 'Christmas Island', '(6798)')
, ('CC', 'Cocos (Keeling) Islands', '(6799)')
, ('CO', 'Colombia', '\d{6}')
, ('KM', 'Comoros', '.{1,255}')
, ('CG', 'Congo (Brazzaville)', '.{1,255}')
, ('CD', 'Congo (Kinshasa)', '.{1,255}')
, ('CK', 'Cook Islands', '.{1,255}')
, ('CR', 'Costa Rica', '\d{5}')
, ('HR', 'Croatia', '[1-5]\d{4}')
, ('CU', 'Cuba', '(CP)?\d{5}')
, ('CW', 'Curaçao', '.{1,255}')
, ('CY', 'Cyprus', '[1-9]\d{3}')
, ('CZ', 'Czech Republic', '[1-7][0-9]{2} [0-9]{2}|[1-7][0-9]{4}')
, ('DK', 'Denmark', '\d{4}')
, ('DJ', 'Djibouti', '.{1,255}')
, ('DM', 'Dominica', '.{1,255}')
, ('DO', 'Dominican Republic', '\d{5}')
, ('EC', 'Ecuador', '\d{6}')
, ('EG', 'Egypt', '\d{5}')
, ('SV', 'El Salvador', '\d{4}')
, ('GQ', 'Equatorial Guinea', '.{1,255}')
, ('ER', 'Eritrea', '.{1,255}')
, ('EE', 'Estonia', '\d{5}')
, ('ET', 'Ethiopia', '\d{4}')
, ('FK', 'Falkland Islands', '(FIQQ 1ZZ)')
, ('FO', 'Faroe Islands', '\d{3}')
, ('FJ', 'Fiji', '.{1,255}')
, ('FI', 'Finland', '\d{5}')
, ('FR', 'France', '\d{5}')
, ('GF', 'French Guiana', '.{1,255}')
, ('PF', 'French Polynesia', '((987)\d{2})')
, ('TF', 'French Southern Territories', '.{1,255}')
, ('GA', 'Gabon', '.{1,255}')
, ('GM', 'Gambia', '.{1,255}')
, ('GE', 'Georgia', '\d{4}')
, ('DE', 'Germany', '\d{5}')
, ('GH', 'Ghana', '.{1,255}')
, ('GI', 'Gibraltar', '(GX11 1AA)')
, ('GR', 'Greece', '(\d{3}) \d{2}|\d{5}')
, ('GL', 'Greenland', '39\d{2}')
, ('GD', 'Grenada', '.{1,255}')
, ('GP', 'Guadeloupe', '.{1,255}')
, ('GU', 'Guam', '((969)[1-3][0-2])(-\d{4})?')
, ('GT', 'Guatemala', '\d{5}')
, ('GG', 'Guernsey', '(GY)([0-9][0-9A-HJKPS-UW]?|[A-HK-Y][0-9][0-9ABEHMNPRV-Y]?) [0-9][ABD-HJLNP-UW-Z]{2}')
, ('GN', 'Guinea', '\d{3}')
, ('GW', 'Guinea-Bissau', '\d{4}')
, ('GY', 'Guyana', '.{1,255}')
, ('HT', 'Haiti', '(HT)(\d{4})|(HT) (\d{4})')
, ('HM', 'Heard Island and McDonald Islands', '(7151)')
, ('HN', 'Honduras', '\d{5}')
, ('HK', 'Hong Kong', '(999077)')
, ('HU', 'Hungary', '[1-9]\d{3}')
, ('IS', 'Iceland', '[1-9]\d{2}')
, ('IN', 'India', '[1-9]\d{5}')
, ('ID', 'Indonesia', '[1-9]\d{4}')
, ('IR', 'Iran', '\d{5}[\-]?\d{5}')
, ('IQ', 'Iraq', '\d{5}')
, ('IE', 'Ireland', '.{1,255}')
, ('IM', 'Isle of Man', '(IM)([0-9][0-9A-HJKPS-UW]?|[A-HK-Y][0-9][0-9ABEHMNPRV-Y]?) [0-9][ABD-HJLNP-UW-Z]{2}')
, ('IL', 'Israel', '\d{7}')
, ('IT', 'Italy', '\d{5}')
, ('CI', 'Ivory Coast', '.{1,255}')
, ('JM', 'Jamaica', '(JM)[A-Z]{3}\d{2}')
, ('JP', 'Japan', '(\d{3}-\d{4})')
, ('JE', 'Jersey', 'JE[0-9]{1}[\s]([\d][A-Z]{2})')
, ('JO', 'Jordan', '\d{5}')
, ('KZ', 'Kazakhstan', '([A-Z]\d{2}[A-Z]\d[A-Z]\d)|(\d{6})')
, ('KE', 'Kenya', '\d{5}')
, ('KI', 'Kiribati', 'KI\d{4}')
, ('KW', 'Kuwait', '\d{5}')
, ('KG', 'Kyrgyzstan', '\d{6}')
, ('LA', 'Laos', '\d{5}')
, ('LV', 'Latvia', '((LV)[\-])?(\d{4})')
, ('LB', 'Lebanon', '\d{4}( \d{4})?')
, ('LS', 'Lesotho', '\d{3}')
, ('LR', 'Liberia', '\d{4}')
, ('LY', 'Libya', '.{1,255}')
, ('LI', 'Liechtenstein', '\d{4}')
, ('LT', 'Lithuania', '((LT)[\-])?(\d{5})')
, ('LU', 'Luxembourg', '((L)[\-])?(\d{4})')
, ('MO', 'Macao', '.{1,255}')
, ('MK', 'North Macedonia', '\d{4}')
, ('MG', 'Madagascar', '\d{3}')
, ('MW', 'Malawi', '\d{6}')
, ('MY', 'Malaysia', '\d{5}')
, ('MV', 'Maldives', '\d{5}')
, ('ML', 'Mali', '.{1,255}')
, ('MT', 'Malta', '[A-Z]{3} [0-9]{4}|[A-Z]{2}[0-9]{2}|[A-Z]{2} [0-9]{2}|[A-Z]{3}[0-9]{4}|[A-Z]{3}[0-9]{2}|[A-Z]{3} [0-9]{2}')
, ('MH', 'Marshall Islands', '((969)[6-7][0-9])(-\d{4})?')
, ('MQ', 'Martinique', '.{1,255}')
, ('MR', 'Mauritania', '.{1,255}')
, ('MU', 'Mauritius', '([0-9A-R]\d{4})')
, ('YT', 'Mayotte', '.{1,255}')
, ('MX', 'Mexico', '\d{5}')
, ('FM', 'Micronesia', '9694\d{1}(-\d{4})?')
, ('MD', 'Moldova', '(MD[\-]?)?(\d{4})')
, ('MC', 'Monaco', '.{1,255}')
, ('MN', 'Mongolia', '\d{5}')
, ('ME', 'Montenegro', '\d{5}')
, ('MS', 'Montserrat', 'MSR\d{4}')
, ('MA', 'Morocco', '[1-9]\d{4}')
, ('MZ', 'Mozambique', '\d{4}')
, ('MM', 'Myanmar', '\d{5}')
, ('NA', 'Namibia', '\d{5}')
, ('NR', 'Nauru', '(NRU68)')
, ('NP', 'Nepal', '\d{5}')
, ('NL', 'Netherlands', '[1-9]\d{3} [A-Z]{2}|[1-9]\d{3}[A-Z]{2}')
, ('NC', 'New Caledonia', '988\d{2}')
, ('NZ', 'New Zealand', '\d{4}')
, ('NI', 'Nicaragua', '\d{5}')
, ('NE', 'Niger', '\d{4}')
, ('NG', 'Nigeria', '[1-9]\d{5}')
, ('NU', 'Niue', '(9974)')
, ('NF', 'Norfolk Island', '(2899)')
, ('MP', 'Northern Mariana Islands', '9695\d{1}(-\d{4})?')
, ('KP', 'North Korea', '.{1,255}')
, ('NO', 'Norway', '\d{4}')
, ('OM', 'Oman', '\d{3}')
, ('PK', 'Pakistan', '[1-9]\d{4}')
, ('PS', 'Palestinian Territory', '(P[1-9]\d{6})|(\d{3}-\d{3})')
, ('PA', 'Panama', '\d{4}')
, ('PG', 'Papua New Guinea', '\d{3}')
, ('PY', 'Paraguay', '\d{4}')
, ('PE', 'Peru', '\d{5}')
, ('PH', 'Philippines', '\d{4}')
, ('PN', 'Pitcairn', '(PCR9 1ZZ)')
, ('PL', 'Poland', '[0-9]{2}[-]([0-9]){3}')
, ('PT', 'Portugal', '[1-9]\d{3}((-)\d{3})')
, ('PR', 'Puerto Rico', '.{1,255}')
, ('QA', 'Qatar', '.{1,255}')
, ('RE', 'Reunion', '.{1,255}')
, ('RO', 'Romania', '\d{6}')
, ('RU', 'Russia', '\d{6}')
, ('RW', 'Rwanda', '.{1,255}')
, ('BL', 'Saint Barthélemy', '.{1,255}')
, ('SH', 'Saint Helena', '(ASCN 1ZZ|TDCU 1ZZ|STHL 1ZZ)')
, ('KN', 'Saint Kitts and Nevis', 'KN\d{4}(\-\d{4})?')
, ('LC', 'Saint Lucia', 'LC\d{2} \d{3}')
, ('MF', 'Saint Martin (French part)', '.{1,255}')
, ('SX', 'Saint Martin (Dutch part)', '.{1,255}')
, ('PM', 'Saint Pierre and Miquelon', '.{1,255}')
, ('VC', 'Saint Vincent and the Grenadines', '(VC)(\d{4})')
, ('SM', 'San Marino', '(4789\d)')
, ('ST', 'São Tomé and Príncipe', '.{1,255}')
, ('SA', 'Saudi Arabia', '[1-8]\d{4}([\-]\d{4})?')
, ('SN', 'Senegal', '[1-8]\d{4}')
, ('RS', 'Serbia', '\d{5,6}')
, ('SC', 'Seychelles', '.{1,255}')
, ('SL', 'Sierra Leone', '.{1,255}')
, ('SG', 'Singapore', '\d{6}')
, ('SK', 'Slovakia', '(\d{3} \d{2})|\d{5}')
, ('SI', 'Slovenia', '[1-9]\d{3}')
, ('SB', 'Solomon Islands', '.{1,255}')
, ('SO', 'Somalia', '.{1,255}')
, ('ZA', 'South Africa', '\d{4}')
, ('GS', 'South Georgia/Sandwich Islands', '(SIQQ 1ZZ)')
, ('KR', 'South Korea', '\d{5}')
, ('SS', 'South Sudan', '\d{5}')
, ('ES', 'Spain', '\d{5}')
, ('LK', 'Sri Lanka', '\d{5}')
, ('SD', 'Sudan', '\d{5}')
, ('SR', 'Suriname', '.{1,255}')
, ('SJ', 'Svalbard and Jan Mayen', '.{1,255}')
, ('SZ', 'Eswatini', '([A-Z]\d{3})')
, ('SE', 'Sweden', '[1-9]\d{2} \d{2}')
, ('CH', 'Switzerland', '[1-9]\d{3}')
, ('SY', 'Syria', '.{1,255}')
, ('TW', 'Taiwan', '(\d{3}\-\d{3})|(\d{3}[-]\d{2})|(\d{6})|(\d{3})')
, ('TJ', 'Tajikistan', '7\d{5}')
, ('TZ', 'Tanzania', '\d{5}')
, ('TH', 'Thailand', '\d{5}')
, ('TL', 'Timor-Leste', '.{1,255}')
, ('TG', 'Togo', '.{1,255}')
, ('TK', 'Tokelau', '.{1,255}')
, ('TO', 'Tonga', '.{1,255}')
, ('TT', 'Trinidad and Tobago', '\d{6}')
, ('TN', 'Tunisia', '\d{4}')
, ('TR', 'Turkey', '\d{5}')
, ('TM', 'Turkmenistan', '7\d{5}')
, ('TC', 'Turks and Caicos Islands', '(TKCA 1ZZ)')
, ('TV', 'Tuvalu', '.{1,255}')
, ('UG', 'Uganda', '.{1,255}')
, ('UA', 'Ukraine', '\d{5}')
, ('AE', 'United Arab Emirates', '.{1,255}')
, ('GB', 'United Kingdom (UK)', '([G][I][R] 0[A]{2})|((([A-Z][0-9]{1,2})|(([A-Z][A-HJ-Y][0-9]{1,2})|(([A-Z][0-9][A-Z])|([A-Z][A-HJ-Y][0-9]?[A-Z])))) [0-9][A-Z]{2})')
, ('US', 'United States (US)', '\d{5}(-\d{4})?')
, ('UM', 'United States (US) Minor Outlying Islands', '.{1,255}')
, ('UY', 'Uruguay', '[1-9]\d{4}')
, ('UZ', 'Uzbekistan', '\d{6}')
, ('VU', 'Vanuatu', '.{1,255}')
, ('VA', 'Vatican', '(00120)')
, ('VE', 'Venezuela', '[1-8]\d{3}')
, ('VN', 'Vietnam', '\d{6}')
, ('VG', 'Virgin Islands (British)', '(VG11)[0-6][0]')
, ('VI', 'Virgin Islands (US)', '008\d{2}(-\d{4})?')
, ('WF', 'Wallis and Futuna', '(986)\d{2}')
, ('EH', 'Western Sahara', '.{1,255}')
, ('WS', 'Samoa', 'WS[1-2]\d{3}')
, ('YE', 'Yemen', '.{1,255}')
, ('ZM', 'Zambia', '\d{5}')
, ('ZW', 'Zimbabwe', '.{1,255}')
;
-- Translation from WooCommerce
insert into numerus.country_i18n
(country_code, lang_tag, name)
values ('AD', 'ca', 'Andorra')
, ('AD', 'es', 'Andorra')
, ('AE', 'ca', 'Emirats Àrabs Units')
, ('AE', 'es', 'Emiratos Árabes Unidos')
, ('AF', 'ca', 'Afganistan')
, ('AF', 'es', 'Afganistán')
, ('AG', 'ca', 'Antigua i Barbuda')
, ('AG', 'es', 'Antigua y Barbuda')
, ('AI', 'ca', 'Anguilla')
, ('AI', 'es', 'Anguilla')
, ('AL', 'ca', 'Albània')
, ('AL', 'es', 'Albania')
, ('AM', 'ca', 'Armènia')
, ('AM', 'es', 'Armenia')
, ('AO', 'ca', 'Angola')
, ('AO', 'es', 'Angola')
, ('AQ', 'ca', 'Antàrtida')
, ('AQ', 'es', 'Antártida')
, ('AR', 'ca', 'Argentina')
, ('AR', 'es', 'Argentina')
, ('AS', 'ca', 'Samoa Nord-americana')
, ('AS', 'es', 'Samoa Americana')
, ('AT', 'ca', 'Àustria')
, ('AT', 'es', 'Austria')
, ('AU', 'ca', 'Austràlia')
, ('AU', 'es', 'Australia')
, ('AW', 'ca', 'Aruba')
, ('AW', 'es', 'Aruba')
, ('AX', 'ca', 'Illes Åland')
, ('AX', 'es', 'Islas Åland')
, ('AZ', 'ca', 'Azerbaidjan')
, ('AZ', 'es', 'Azerbaijan')
, ('BA', 'ca', 'Bòsnia i Hercegovina')
, ('BA', 'es', 'Bosnia y Herzegovina')
, ('BB', 'ca', 'Barbados')
, ('BB', 'es', 'Barbados')
, ('BD', 'ca', 'Bangladesh')
, ('BD', 'es', 'Bangladesh')
, ('BE', 'ca', 'Bèlgica')
, ('BE', 'es', 'Bélgica')
, ('BF', 'ca', 'Burkina Fasso')
, ('BF', 'es', 'Burkina Faso')
, ('BG', 'ca', 'Bulgària')
, ('BG', 'es', 'Bulgaria')
, ('BH', 'ca', 'Bahrain')
, ('BH', 'es', 'Bahrain')
, ('BI', 'ca', 'Burundi')
, ('BI', 'es', 'Burundi')
, ('BJ', 'ca', 'Benín')
, ('BJ', 'es', 'Benin')
, ('BL', 'ca', 'Saint-Barthélemy')
, ('BL', 'es', 'San Bartolomé')
, ('BM', 'ca', 'Bermuda')
, ('BM', 'es', 'Bermuda')
, ('BN', 'ca', 'Brunei')
, ('BN', 'es', 'Brunéi')
, ('BO', 'ca', 'Bolívia')
, ('BO', 'es', 'Bolivia')
, ('BQ', 'ca', 'Bonaire, Saint Eustatius and Saba')
, ('BQ', 'es', 'Bonaire, San Eustaquio y Saba')
, ('BR', 'ca', 'Brasil')
, ('BR', 'es', 'Brasil')
, ('BS', 'ca', 'Bahames')
, ('BS', 'es', 'Bahamas')
, ('BT', 'ca', 'Bhutan')
, ('BT', 'es', 'Bhutan')
, ('BV', 'ca', 'Illa Bouvet')
, ('BV', 'es', 'Isla Bouvet')
, ('BW', 'ca', 'Botswana')
, ('BW', 'es', 'Botswana')
, ('BY', 'ca', 'Bielorússia')
, ('BY', 'es', 'Bielorrusia')
, ('BZ', 'ca', 'Belize')
, ('BZ', 'es', 'Belize')
, ('CA', 'ca', 'Canadà')
, ('CA', 'es', 'Canadá')
, ('CC', 'ca', 'Illes Cocos (Keeling)')
, ('CC', 'es', 'Islas Cocos')
, ('CD', 'ca', 'Congo (Kinshasa)')
, ('CD', 'es', 'Congo (Kinshasa)')
, ('CF', 'ca', 'República Centreafricana')
, ('CF', 'es', 'República Centroafricana')
, ('CG', 'ca', 'Congo (Brazzaville)')
, ('CG', 'es', 'Congo (Brazzaville)')
, ('CH', 'ca', 'Suïssa')
, ('CH', 'es', 'Suiza')
, ('CI', 'ca', 'Costa dIvori')
, ('CI', 'es', 'Costa de Marfil')
, ('CK', 'ca', 'Illes Cook')
, ('CK', 'es', 'Islas Cook')
, ('CL', 'ca', 'Xile')
, ('CL', 'es', 'Chile')
, ('CM', 'ca', 'Camerun')
, ('CM', 'es', 'Camerún')
, ('CN', 'ca', 'Xina')
, ('CN', 'es', 'China')
, ('CO', 'ca', 'Colòmbia')
, ('CO', 'es', 'Colombia')
, ('CR', 'ca', 'Costa Rica')
, ('CR', 'es', 'Costa Rica')
, ('CU', 'ca', 'Cuba')
, ('CU', 'es', 'Cuba')
, ('CV', 'ca', 'Cap Verd')
, ('CV', 'es', 'Cabo Verde')
, ('CW', 'ca', 'Curaçao')
, ('CW', 'es', 'Curaçao')
, ('CX', 'ca', 'Illa Christmas')
, ('CX', 'es', 'Isla de Navidad')
, ('CY', 'ca', 'Xipre')
, ('CY', 'es', 'Chipre')
, ('CZ', 'ca', 'República Txeca')
, ('CZ', 'es', 'República Checa')
, ('DE', 'ca', 'Alemanya')
, ('DE', 'es', 'Alemania')
, ('DJ', 'ca', 'Djibouti')
, ('DJ', 'es', 'Djibouti')
, ('DK', 'ca', 'Dinamarca')
, ('DK', 'es', 'Dinamarca')
, ('DM', 'ca', 'Dominica')
, ('DM', 'es', 'Dominica')
, ('DO', 'ca', 'República Dominicana')
, ('DO', 'es', 'República Dominicana')
, ('DZ', 'ca', 'Algèria')
, ('DZ', 'es', 'Argelia')
, ('EC', 'ca', 'Equador')
, ('EC', 'es', 'Ecuador')
, ('EE', 'ca', 'Estònia')
, ('EE', 'es', 'Estonia')
, ('EG', 'ca', 'Egipte')
, ('EG', 'es', 'Egipto')
, ('EH', 'ca', 'Sàhara Occidental')
, ('EH', 'es', 'Sahara Occidental')
, ('ER', 'ca', 'Eritrea')
, ('ER', 'es', 'Eritrea')
, ('ES', 'ca', 'Espanya')
, ('ES', 'es', 'España')
, ('ET', 'ca', 'Etiòpia')
, ('ET', 'es', 'Etiopía')
, ('FI', 'ca', 'Finlàndia')
, ('FI', 'es', 'Finlandia')
, ('FJ', 'ca', 'Fiji')
, ('FJ', 'es', 'Fiyi')
, ('FK', 'ca', 'Illes Falkland')
, ('FK', 'es', 'Islas Malvinas')
, ('FM', 'ca', 'Micronèsia')
, ('FM', 'es', 'Micronesia')
, ('FO', 'ca', 'Illes Faroe')
, ('FO', 'es', 'Islas Feroe')
, ('FR', 'ca', 'França')
, ('FR', 'es', 'Francia')
, ('GA', 'ca', 'Gabon')
, ('GA', 'es', 'Gabón')
, ('GB', 'ca', 'Regne Unit (UK)')
, ('GB', 'es', 'Reino Unido (UK)')
, ('GD', 'ca', 'Grenada')
, ('GD', 'es', 'Granada')
, ('GE', 'ca', 'Geòrgia')
, ('GE', 'es', 'Georgia')
, ('GF', 'ca', 'Guaiana Francesa')
, ('GF', 'es', 'Guayana Francesa')
, ('GG', 'ca', 'Guernsey')
, ('GG', 'es', 'Guernsey')
, ('GH', 'ca', 'Ghana')
, ('GH', 'es', 'Ghana')
, ('GI', 'ca', 'Gibraltar')
, ('GI', 'es', 'Gibraltar')
, ('GL', 'ca', 'Groenlàndia')
, ('GL', 'es', 'Groenlandia')
, ('GM', 'ca', 'Gàmbia')
, ('GM', 'es', 'Gambia')
, ('GN', 'ca', 'Guinea')
, ('GN', 'es', 'Guinea')
, ('GP', 'ca', 'Guadalupe')
, ('GP', 'es', 'Guadalupe')
, ('GQ', 'ca', 'Guinea Equatorial')
, ('GQ', 'es', 'Guinea Ecuatorial')
, ('GR', 'ca', 'Grècia')
, ('GR', 'es', 'Grecia')
, ('GS', 'ca', 'Illes Geòrgia del Sud i Sandwich del Sud')
, ('GS', 'es', 'Islas Georgias y Sandwich del Sur')
, ('GT', 'ca', 'Guatemala')
, ('GT', 'es', 'Guatemala')
, ('GU', 'ca', 'Guam')
, ('GU', 'es', 'Guam')
, ('GW', 'ca', 'Guinea Bissau')
, ('GW', 'es', 'Guinea-Bisáu')
, ('GY', 'ca', 'Guyana')
, ('GY', 'es', 'Guyana')
, ('HK', 'ca', 'Hong Kong')
, ('HK', 'es', 'Hong Kong')
, ('HM', 'ca', 'Illes Heard i McDonald')
, ('HM', 'es', 'Islas Heard y McDonald')
, ('HN', 'ca', 'Hondures')
, ('HN', 'es', 'Honduras')
, ('HR', 'ca', 'Croàcia')
, ('HR', 'es', 'Croacia')
, ('HT', 'ca', 'Haití')
, ('HT', 'es', 'Haití')
, ('HU', 'ca', 'Hongria')
, ('HU', 'es', 'Hungría')
, ('ID', 'ca', 'Indonèsia')
, ('ID', 'es', 'Indonesia')
, ('IE', 'ca', 'Irlanda')
, ('IE', 'es', 'Irlanda')
, ('IL', 'ca', 'Israel')
, ('IL', 'es', 'Israel')
, ('IM', 'ca', 'Illa de Man')
, ('IM', 'es', 'Isla de Man')
, ('IN', 'ca', 'Índia')
, ('IN', 'es', 'India')
, ('IO', 'ca', 'Territori Britànic de lOceà Índic')
, ('IO', 'es', 'Territorio Británico del Océano Índico')
, ('IQ', 'ca', 'Iraq')
, ('IQ', 'es', 'Irak')
, ('IR', 'ca', 'Iran')
, ('IR', 'es', 'Irán')
, ('IS', 'ca', 'Islàndia')
, ('IS', 'es', 'Islandia')
, ('IT', 'ca', 'Itàlia')
, ('IT', 'es', 'Italia')
, ('JE', 'ca', 'Jersey')
, ('JE', 'es', 'Jersey')
, ('JM', 'ca', 'Jamaica')
, ('JM', 'es', 'Jamaica')
, ('JO', 'ca', 'Jordània')
, ('JO', 'es', 'Jordania')
, ('JP', 'ca', 'Japó')
, ('JP', 'es', 'Japón')
, ('KE', 'ca', 'Kenya')
, ('KE', 'es', 'Kenia')
, ('KG', 'ca', 'Kirguizistan')
, ('KG', 'es', 'Kirguistán')
, ('KH', 'ca', 'Cambodja')
, ('KH', 'es', 'Camboya')
, ('KI', 'ca', 'Kiribati')
, ('KI', 'es', 'Kiribati')
, ('KM', 'ca', 'Comores')
, ('KM', 'es', 'Comoras')
, ('KN', 'ca', 'Saint Kitts i Nevis')
, ('KN', 'es', 'San Cristóbal y Nieves')
, ('KP', 'ca', 'Corea del Nord')
, ('KP', 'es', 'Corea del Norte')
, ('KR', 'ca', 'Corea del Sud')
, ('KR', 'es', 'Corea del Sur')
, ('KW', 'ca', 'Kuwait')
, ('KW', 'es', 'Kuwait')
, ('KY', 'ca', 'Illes Caiman')
, ('KY', 'es', 'Islas Caimán')
, ('KZ', 'ca', 'Kazakhstan')
, ('KZ', 'es', 'Kazajistán')
, ('LA', 'ca', 'Laos')
, ('LA', 'es', 'Laos')
, ('LB', 'ca', 'Líban')
, ('LB', 'es', 'Líbano')
, ('LC', 'ca', 'Saint Lucia')
, ('LC', 'es', 'Santa Lucía')
, ('LI', 'ca', 'Liechtenstein')
, ('LI', 'es', 'Liechtenstein')
, ('LK', 'ca', 'Sri Lanka')
, ('LK', 'es', 'Sri Lanka')
, ('LR', 'ca', 'Libèria')
, ('LR', 'es', 'Liberia')
, ('LS', 'ca', 'Lesotho')
, ('LS', 'es', 'Lesoto')
, ('LT', 'ca', 'Lituània')
, ('LT', 'es', 'Lituania')
, ('LU', 'ca', 'Luxemburg')
, ('LU', 'es', 'Luxemburgo')
, ('LV', 'ca', 'Letònia')
, ('LV', 'es', 'Letonia')
, ('LY', 'ca', 'Líbia')
, ('LY', 'es', 'Libia')
, ('MA', 'ca', 'Marroc')
, ('MA', 'es', 'Marruecos')
, ('MC', 'ca', 'Mònaco')
, ('MC', 'es', 'Mónaco')
, ('MD', 'ca', 'Moldàvia')
, ('MD', 'es', 'Moldavia')
, ('ME', 'ca', 'Montenegro')
, ('ME', 'es', 'Montenegro')
, ('MF', 'ca', 'Saint Martin (part francesa)')
, ('MF', 'es', 'San Martín (parte de Francia)')
, ('MG', 'ca', 'Madagascar')
, ('MG', 'es', 'Madagascar')
, ('MH', 'ca', 'Illes Marshall')
, ('MH', 'es', 'Islas Marshall')
, ('MK', 'ca', 'Macedònia del Nord')
, ('MK', 'es', 'Macedonia del Norte')
, ('ML', 'ca', 'Mali')
, ('ML', 'es', 'Malí')
, ('MM', 'ca', 'Myanmar')
, ('MM', 'es', 'Birmania')
, ('MN', 'ca', 'Mongòlia')
, ('MN', 'es', 'Mongolia')
, ('MO', 'ca', 'Macau')
, ('MO', 'es', 'Macao')
, ('MP', 'ca', 'Illes Mariannes Septentrionals')
, ('MP', 'es', 'Islas Marianas del Norte')
, ('MQ', 'ca', 'Martinica')
, ('MQ', 'es', 'Martinica')
, ('MR', 'ca', 'Mauritània')
, ('MR', 'es', 'Mauritania')
, ('MS', 'ca', 'Montserrat')
, ('MS', 'es', 'Montserrat')
, ('MT', 'ca', 'Malta')
, ('MT', 'es', 'Malta')
, ('MU', 'ca', 'Maurici')
, ('MU', 'es', 'Mauricio')
, ('MV', 'ca', 'Maldives')
, ('MV', 'es', 'Maldivas')
, ('MW', 'ca', 'Malawi')
, ('MW', 'es', 'Malaui')
, ('MX', 'ca', 'Mèxic')
, ('MX', 'es', 'México')
, ('MY', 'ca', 'Malàisia')
, ('MY', 'es', 'Malasia')
, ('MZ', 'ca', 'Moçambic')
, ('MZ', 'es', 'Mozambique')
, ('NA', 'ca', 'Namíbia')
, ('NA', 'es', 'Namibia')
, ('NC', 'ca', 'Nova Caledònia')
, ('NC', 'es', 'Nueva Caledonia')
, ('NE', 'ca', 'Níger')
, ('NE', 'es', 'Níger')
, ('NF', 'ca', 'Illa Norfolk')
, ('NF', 'es', 'Isla Norfolk')
, ('NG', 'ca', 'Nigèria')
, ('NG', 'es', 'Nigeria')
, ('NI', 'ca', 'Nicaragua')
, ('NI', 'es', 'Nicaragua')
, ('NL', 'ca', 'Països Baixos')
, ('NL', 'es', 'Países Bajos')
, ('NO', 'ca', 'Noruega')
, ('NO', 'es', 'Noruega')
, ('NP', 'ca', 'Nepal')
, ('NP', 'es', 'Nepal')
, ('NR', 'ca', 'Nauru')
, ('NR', 'es', 'Nauru')
, ('NU', 'ca', 'Niue')
, ('NU', 'es', 'Niue')
, ('NZ', 'ca', 'Nova Zelanda')
, ('NZ', 'es', 'Nueva Zelanda')
, ('OM', 'ca', 'Oman')
, ('OM', 'es', 'Omán')
, ('PA', 'ca', 'Panamà')
, ('PA', 'es', 'Panamá')
, ('PE', 'ca', 'Perú')
, ('PE', 'es', 'Perú')
, ('PF', 'ca', 'Polinèsia Francesa')
, ('PF', 'es', 'Polinesia Francesa')
, ('PG', 'ca', 'Papua Nova Guinea')
, ('PG', 'es', 'Papúa Nueva Guinea')
, ('PH', 'ca', 'Filipines')
, ('PH', 'es', 'Filipinas')
, ('PK', 'ca', 'Pakistan')
, ('PK', 'es', 'Pakistán')
, ('PL', 'ca', 'Polònia')
, ('PL', 'es', 'Polonia')
, ('PM', 'ca', 'Saint-Pierre i Miquelon')
, ('PM', 'es', 'San Pedro y Miquelón')
, ('PN', 'ca', 'Pitcairn')
, ('PN', 'es', 'Pitcairn')
, ('PR', 'ca', 'Puerto Rico')
, ('PR', 'es', 'Puerto Rico')
, ('PS', 'ca', 'Palestina')
, ('PS', 'es', 'Territorios Palestinos')
, ('PT', 'ca', 'Portugal')
, ('PT', 'es', 'Portugal')
, ('PW', 'ca', 'Belau')
, ('PW', 'es', 'Belau')
, ('PY', 'ca', 'Paraguai')
, ('PY', 'es', 'Paraguay')
, ('QA', 'ca', 'Qatar')
, ('QA', 'es', 'Qatar')
, ('RE', 'ca', 'Reunió')
, ('RE', 'es', 'Reunión')
, ('RO', 'ca', 'Romania')
, ('RO', 'es', 'Rumania')
, ('RS', 'ca', 'Sèrbia')
, ('RS', 'es', 'Serbia')
, ('RU', 'ca', 'Rússia')
, ('RU', 'es', 'Rusia')
, ('RW', 'ca', 'Ruanda')
, ('RW', 'es', 'Ruanda')
, ('SA', 'ca', 'Aràbia Saudita')
, ('SA', 'es', 'Arabia Saudita')
, ('SB', 'ca', 'Illes Salomó')
, ('SB', 'es', 'Islas Salomón')
, ('SC', 'ca', 'Seychelles')
, ('SC', 'es', 'Seychelles')
, ('SD', 'ca', 'Sudan')
, ('SD', 'es', 'Sudán')
, ('SE', 'ca', 'Suècia')
, ('SE', 'es', 'Suecia')
, ('SG', 'ca', 'Singapur')
, ('SG', 'es', 'Singapur')
, ('SH', 'ca', 'Saint Helena')
, ('SH', 'es', 'Isla Santa Elena')
, ('SI', 'ca', 'Eslovènia')
, ('SI', 'es', 'Eslovenia')
, ('SJ', 'ca', 'Svalbard i Jan Mayen')
, ('SJ', 'es', 'Svalbard y Jan Mayen')
, ('SK', 'ca', 'Eslovàquia')
, ('SK', 'es', 'Eslovaquia')
, ('SL', 'ca', 'Sierra Leone')
, ('SL', 'es', 'Sierra Leona')
, ('SM', 'ca', 'San Marino')
, ('SM', 'es', 'San Marino')
, ('SN', 'ca', 'Senegal')
, ('SN', 'es', 'Senegal')
, ('SO', 'ca', 'Somàlia')
, ('SO', 'es', 'Somalia')
, ('SR', 'ca', 'Surinam')
, ('SR', 'es', 'Surinam')
, ('SS', 'ca', 'Sudan del Sud')
, ('SS', 'es', 'Sudán del Sur')
, ('ST', 'ca', 'São Tomé i Príncipe')
, ('ST', 'es', 'Santo Tomé y Príncipe')
, ('SV', 'ca', 'El Salvador')
, ('SV', 'es', 'El Salvador')
, ('SX', 'ca', 'Saint Martin (part holandesa)')
, ('SX', 'es', 'San Martín (Países Bajos)')
, ('SY', 'ca', 'Síria')
, ('SY', 'es', 'Siria')
, ('SZ', 'ca', 'Eswatini')
, ('SZ', 'es', 'Esuatini')
, ('TC', 'ca', 'Illes Turks i Caicos')
, ('TC', 'es', 'Islas Turcas y Caicos')
, ('TD', 'ca', 'Txad')
, ('TD', 'es', 'Chad')
, ('TF', 'ca', 'Terres Australs Franceses')
, ('TF', 'es', 'Territorios australes franceses')
, ('TG', 'ca', 'Togo')
, ('TG', 'es', 'Togo')
, ('TH', 'ca', 'Tailàndia')
, ('TH', 'es', 'Tailandia')
, ('TJ', 'ca', 'Tadjikistan')
, ('TJ', 'es', 'Tayikistán')
, ('TK', 'ca', 'Tokelau')
, ('TK', 'es', 'Tokelau')
, ('TL', 'ca', 'Timor Oriental')
, ('TL', 'es', 'Timor Oriental')
, ('TM', 'ca', 'Turkmenistan')
, ('TM', 'es', 'Turkmenistán')
, ('TN', 'ca', 'Tunísia')
, ('TN', 'es', 'Túnez')
, ('TO', 'ca', 'Tonga')
, ('TO', 'es', 'Tonga')
, ('TR', 'ca', 'Turquia')
, ('TR', 'es', 'Turquía')
, ('TT', 'ca', 'Trinitat i Tobago')
, ('TT', 'es', 'Trinidad y Tobago')
, ('TV', 'ca', 'Tuvalu')
, ('TV', 'es', 'Tuvalu')
, ('TW', 'ca', 'Taiwan')
, ('TW', 'es', 'Taiwán')
, ('TZ', 'ca', 'Tanzània')
, ('TZ', 'es', 'Tanzania')
, ('UA', 'ca', 'Ucraïna')
, ('UA', 'es', 'Ucrania')
, ('UG', 'ca', 'Uganda')
, ('UG', 'es', 'Uganda')
, ('UM', 'ca', 'Illes dUltramar Menors dels Estats Units')
, ('UM', 'es', 'Islas de ultramar menores de Estados Unidos (EEUU)')
, ('US', 'ca', 'Estats Units (US)')
, ('US', 'es', 'Estados Unidos (EEUU)')
, ('UY', 'ca', 'Uruguai')
, ('UY', 'es', 'Uruguay')
, ('UZ', 'ca', 'Uzbekistan')
, ('UZ', 'es', 'Uzbekistán')
, ('VA', 'ca', 'Vaticà')
, ('VA', 'es', 'Ciudad del Vaticano')
, ('VC', 'ca', 'Saint Vincent i les Grenadines')
, ('VC', 'es', 'San Vicente y las Granadinas')
, ('VE', 'ca', 'Veneçuela')
, ('VE', 'es', 'Venezuela')
, ('VG', 'ca', 'Illes Verges (Britàniques)')
, ('VG', 'es', 'Islas Vírgenes (Británicas)')
, ('VI', 'ca', 'Illes Verges (EUA)')
, ('VI', 'es', 'Islas Vírgenes (EEUU)')
, ('VN', 'ca', 'Vietnam')
, ('VN', 'es', 'Vietnam')
, ('VU', 'ca', 'Vanuatu')
, ('VU', 'es', 'Vanuatu')
, ('WF', 'ca', 'Wallis i Futuna')
, ('WF', 'es', 'Wallis y Futuna')
, ('WS', 'ca', 'Samoa')
, ('WS', 'es', 'Samoa')
, ('YE', 'ca', 'Iemen')
, ('YE', 'es', 'Yemen')
, ('YT', 'ca', 'Mayotte')
, ('YT', 'es', 'Mayotte')
, ('ZA', 'ca', 'Sud-àfrica')
, ('ZA', 'es', 'Sudáfrica')
, ('ZM', 'ca', 'Zàmbia')
, ('ZM', 'es', 'Zambia')
, ('ZW', 'ca', 'Zimbàbue')
, ('ZW', 'es', 'Zimbabue')
;
commit;

View File

@ -24,7 +24,7 @@ create table company (
city text not null,
province text not null,
postal_code text not null,
country_code country_code not null references country,
country text not null,
currency_code currency_code not null references currency,
created_at timestamptz not null default current_timestamp
);

View File

@ -1,18 +0,0 @@
-- Deploy numerus:country to pg
-- requires: schema_numerus
-- requires: country_code
begin;
set search_path to numerus, public;
create table country (
country_code country_code not null primary key,
name text not null,
postal_code_regex text not null
);
grant select on table country to invoicer;
grant select on table country to admin;
commit;

View File

@ -1,14 +0,0 @@
-- Deploy numerus:country_code to pg
-- requires: schema_numerus
begin;
set search_path to numerus, public;
create domain country_code as text
check (value ~ '^[A-Z]{2}$');
comment on domain country_code is
'A correctly formated, but not necessarily valid, ISO 3166-1 alpha-2 country code';
commit;

View File

@ -1,21 +0,0 @@
-- Deploy numerus:country_i18n to pg
-- requires: schema_numerus
-- requires: country_code
-- requires: language
-- requires: country
begin;
set search_path to numerus, public;
create table country_i18n (
country_code country_code not null references country,
lang_tag text not null references language,
name text not null,
primary key (country_code, lang_tag)
);
grant select on table country_i18n to invoicer;
grant select on table country_i18n to admin;
commit;

View File

@ -9,6 +9,6 @@ create domain currency_code as text
check (value ~ '^[A-Z]{3}$');
comment on domain currency_code is
'A correctly formatted, but not necessarily valid, ISO 4217 currency code';
'A correctly formated, but not necessarily valid, ISO 4217 currency code';
commit;

View File

@ -65,11 +65,6 @@ func getCompany(r *http.Request) *Company {
return company.(*Company)
}
type CountryOption struct {
Code string
Name string
}
type TaxDetailsPage struct {
Title string
BusinessName string
@ -82,8 +77,7 @@ type TaxDetailsPage struct {
City string
Province string
PostalCode string
CountryCode string
Countries []CountryOption
Country string
}
func CompanyTaxDetailsHandler() http.Handler {
@ -97,8 +91,7 @@ func CompanyTaxDetailsHandler() http.Handler {
if r.Method == "POST" {
r.ParseForm()
page.BusinessName = r.FormValue("business_name")
page.CountryCode = r.FormValue("country")
page.VATIN = page.CountryCode + r.FormValue("vatin")
page.VATIN = r.FormValue("vatin")
page.TradeName = r.FormValue("trade_name")
page.Phone = r.FormValue("phone")
page.Email = r.FormValue("email")
@ -107,15 +100,15 @@ func CompanyTaxDetailsHandler() http.Handler {
page.City = r.FormValue("city")
page.Province = r.FormValue("province")
page.PostalCode = r.FormValue("postal_code")
conn.MustExec(r.Context(), "update company set business_name = $1, vatin = $2, trade_name = $3, phone = parse_packed_phone_number($4, $11), email = $5, web = $6, address = $7, city = $8, province = $9, postal_code = $10, country_code = $11 where company_id = $12", page.BusinessName, page.VATIN, page.TradeName, page.Phone, page.Email, page.Web, page.Address, page.City, page.Province, page.PostalCode, page.CountryCode, company.Id)
page.Country = r.FormValue("country")
conn.MustExec(r.Context(), "update company set business_name = $1, vatin = $2, trade_name = $3, phone = $4, email = $5, web = $6, address = $7, city = $8, province = $9, postal_code = $10, country = $11 where company_id = $12", page.BusinessName, page.VATIN, page.TradeName, page.Phone, page.Email, page.Web, page.Address, page.City, page.Province, page.PostalCode, page.Country, company.Id)
http.Redirect(w, r, "/company/"+company.Slug+"/tax-details", http.StatusSeeOther)
} else {
err := conn.QueryRow(r.Context(), "select business_name, substr(vatin::text, 3), trade_name, phone, email, web, address, city, province, postal_code, country_code from company where company_id = $1", company.Id).Scan(&page.BusinessName, &page.VATIN, &page.TradeName, &page.Phone, &page.Email, &page.Web, &page.Address, &page.City, &page.Province, &page.PostalCode, &page.CountryCode)
err := conn.QueryRow(r.Context(), "select business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country from company where company_id = $1", company.Id).Scan(&page.BusinessName, &page.VATIN, &page.TradeName, &page.Phone, &page.Email, &page.Web, &page.Address, &page.City, &page.Province, &page.PostalCode, &page.Country)
if err != nil {
panic(err)
}
}
page.Countries = mustGetCountryOptions(r.Context(), conn, locale)
mustRenderAppTemplate(w, r, "tax-details.html", page)
})
}
@ -127,26 +120,3 @@ func mustGetCompany(r *http.Request) *Company {
}
return company
}
func mustGetCountryOptions(ctx context.Context, conn *Conn, locale *Locale) []CountryOption {
rows, err := conn.Query(ctx, "select country.country_code, coalesce(i18n.name, country.name) from country left join country_i18n as i18n on country.country_code = i18n.country_code and i18n.lang_tag = $1", locale.Language)
if err != nil {
panic(err)
}
defer rows.Close()
var countries []CountryOption
for rows.Next() {
var country CountryOption
err = rows.Scan(&country.Code, &country.Name)
if err != nil {
panic(err)
}
countries = append(countries, country)
}
if rows.Err() != nil {
panic(rows.Err())
}
return countries
}

View File

@ -10,32 +10,20 @@ import (
const contextLocaleKey = "numerus-locale"
type Locale struct {
*gotext.Locale
Language language.Tag
}
func NewLocale(lang language.Tag) *Locale {
return &Locale{
gotext.NewLocale("locales", lang.String()),
lang,
}
}
func SetLocale(db *Db, next http.Handler) http.Handler {
func Locale(db *Db, next http.Handler) http.Handler {
availableLanguages := mustGetAvailableLanguages(db)
var matcher = language.NewMatcher(availableLanguages)
locales := map[language.Tag]*Locale{}
locales := map[language.Tag]*gotext.Locale{}
for _, lang := range availableLanguages {
locale := NewLocale(lang)
locale := gotext.NewLocale("locales", lang.String())
locale.AddDomain("numerus")
locales[lang] = locale
}
defaultLocale := locales[language.Catalan]
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var locale *Locale
var locale *gotext.Locale
user := getUser(r)
locale = locales[user.Language]
if locale == nil {
@ -58,11 +46,11 @@ func SetLocale(db *Db, next http.Handler) http.Handler {
})
}
func getLocale(r *http.Request) *Locale {
return r.Context().Value(contextLocaleKey).(*Locale)
func getLocale(r *http.Request) *gotext.Locale {
return r.Context().Value(contextLocaleKey).(*gotext.Locale)
}
func pgettext(context string, str string, locale *Locale) string {
func pgettext(context string, str string, locale *gotext.Locale) string {
return locale.GetC(str, context)
}

View File

@ -32,7 +32,7 @@ func NewRouter(db *Db) http.Handler {
}
})
var handler http.Handler = router
handler = SetLocale(db, handler)
handler = Locale(db, handler)
handler = CheckLogin(db, handler)
handler = Recoverer(handler)
handler = Logger(handler)

View File

@ -1,8 +0,0 @@
-- Revert numerus:available_countries from pg
begin;
delete from numerus.country_i18n;
delete from numerus.country;
commit;

View File

@ -3,6 +3,7 @@
begin;
drop policy if exists company_policy on numerus.company;
drop policy if exists company_policy on numerus.company_user;
drop table if exists numerus.company_user;
commit;

View File

@ -1,7 +0,0 @@
-- Revert numerus:country from pg
begin;
drop table if exists numerus.country;
commit;

View File

@ -1,7 +0,0 @@
-- Revert numerus:country_code from pg
begin;
drop domain if exists numerus.country_code;
commit;

View File

@ -1,7 +0,0 @@
-- Revert numerus:country_i18n from pg
begin;
drop table if exists numerus.country_i18n;
commit;

View File

@ -30,9 +30,5 @@ extension_uri [schema_public] 2023-01-24T14:29:29Z jordi fita mas <jordi@tandem.
currency_code [schema_numerus] 2023-01-24T14:36:04Z jordi fita mas <jordi@tandem.blog> # Add the domain for currency code in ISO 4217
currency [schema_numerus currency_code] 2023-01-24T14:45:26Z jordi fita mas <jordi@tandem.blog> # Add the relation for currencies
available_currencies [schema_numerus currency] 2023-01-24T14:54:18Z jordi fita mas <jordi@tandem.blog> # Add the initial list of available currencies
country_code [schema_numerus] 2023-01-27T18:33:26Z jordi fita mas <jordi@tandem.blog> # Add domain for country codes
country [schema_numerus country_code] 2023-01-27T18:39:44Z jordi fita mas <jordi@tandem.blog> # Add the relation for countries
country_i18n [schema_numerus country_code language country] 2023-01-27T19:20:43Z jordi fita mas <jordi@tandem.blog> # Add table for localization of country names
available_countries [schema_numerus country] 2023-01-27T18:49:28Z jordi fita mas <jordi@tandem.blog> # Add the list of available countries
company [schema_numerus extension_vat email extension_pg_libphonenumber extension_uri currency_code currency country_code country] 2023-01-24T15:03:15Z jordi fita mas <jordi@tandem.blog> # Add the relation for companies
company [schema_numerus extension_vat email extension_pg_libphonenumber extension_uri currency_code currency] 2023-01-24T15:03:15Z jordi fita mas <jordi@tandem.blog> # Add the relation for companies
company_user [schema_numerus user company] 2023-01-24T17:50:06Z jordi fita mas <jordi@tandem.blog> # Add the relation of companies and their users

View File

@ -5,7 +5,7 @@ reset client_min_messages;
begin;
select plan(79);
select plan(77);
set search_path to numerus, auth, public;
@ -80,12 +80,10 @@ select col_type_is('company', 'postal_code', 'text');
select col_not_null('company', 'postal_code');
select col_hasnt_default('company', 'postal_code');
select has_column('company', 'country_code');
select col_type_is('company', 'country_code', 'country_code');
select col_is_fk('company', 'country_code');
select fk_ok('company', 'country_code', 'country', 'country_code');
select col_not_null('company', 'country_code');
select col_hasnt_default('company', 'country_code');
select has_column('company', 'country');
select col_type_is('company', 'country', 'text');
select col_not_null('company', 'country');
select col_hasnt_default('company', 'country');
select has_column('company', 'currency_code');
select col_is_fk('company', 'currency_code');
@ -112,10 +110,10 @@ values (1, 'demo@tandem.blog', 'Demo', 'test', 'invoicer', '44facbb30d8a419dfd4b
, (5, 'admin@tandem.blog', 'Demo', 'test', 'admin', '12af4c88b528c2ad4222e3740496ecbc58e76e26f087657524', current_timestamp + interval '1 month')
;
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country_code, currency_code)
values (2, 'Company 2', 'XX123', '', '555-555-555', 'a@a', '', '', '', '', '', 'ES', 'EUR')
, (4, 'Company 4', 'XX234', '', '666-666-666', 'b@b', '', '', '', '', '', 'FR', 'USD')
, (6, 'Company 6', 'XX345', '', '777-777-777', 'c@c', '', '', '', '', '', 'DE', 'USD')
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country, currency_code)
values (2, 'Company 2', 'XX123', '', '555-555-555', 'a@a', '', '', '', '', '', '', 'EUR')
, (4, 'Company 4', 'XX234', '', '666-666-666', 'b@b', '', '', '', '', '', '', 'USD')
, (6, 'Company 6', 'XX345', '', '777-777-777', 'c@c', '', '', '', '', '', '', 'USD')
;
insert into company_user (company_id, user_id)

View File

@ -1,40 +0,0 @@
-- Test country
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(19);
set search_path to numerus, public;
select has_table('country');
select has_pk('country' );
select table_privs_are('country', 'guest', array []::text[]);
select table_privs_are('country', 'invoicer', array ['SELECT']);
select table_privs_are('country', 'admin', array ['SELECT']);
select table_privs_are('country', 'authenticator', array []::text[]);
select has_column('country', 'country_code');
select col_is_pk('country', 'country_code');
select col_type_is('country', 'country_code', 'country_code');
select col_not_null('country', 'country_code');
select col_hasnt_default('country', 'country_code');
select has_column('country', 'name');
select col_type_is('country', 'name', 'text');
select col_not_null('country', 'name');
select col_hasnt_default('country', 'name');
select has_column('country', 'postal_code_regex');
select col_type_is('country', 'postal_code_regex', 'text');
select col_not_null('country', 'postal_code_regex');
select col_hasnt_default('country', 'postal_code_regex');
select *
from finish();
rollback;

View File

@ -1,38 +0,0 @@
-- Test country_code
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(6);
set search_path to numerus, public;
select has_domain('country_code');
select domain_type_is('country_code', 'text');
select lives_ok($$ select 'FR'::country_code $$, 'Should be able to cast valid text to country code');
select throws_ok(
$$ SELECT '12'::country_code $$,
23514, null,
'Should reject numeric text'
);
select throws_ok(
$$ SELECT 'fr'::country_code $$,
23514, null,
'Should reject lowecase text'
);
select throws_ok(
$$ SELECT 'FRA'::country_code $$,
23514, null,
'Should reject text longer than three letters'
);
select *
from finish();
rollback;

View File

@ -1,44 +0,0 @@
-- Test country_i18n
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(23);
set search_path to numerus, public;
select has_table('country_i18n');
select has_pk('country_i18n' );
select col_is_pk('country_i18n', array['country_code', 'lang_tag']);
select table_privs_are('country_i18n', 'guest', array []::text[]);
select table_privs_are('country_i18n', 'invoicer', array ['SELECT']);
select table_privs_are('country_i18n', 'admin', array ['SELECT']);
select table_privs_are('country_i18n', 'authenticator', array []::text[]);
select has_column('country_i18n', 'country_code');
select col_is_fk('country_i18n', 'country_code');
select fk_ok('country_i18n', 'country_code', 'country', 'country_code');
select col_type_is('country_i18n', 'country_code', 'country_code');
select col_not_null('country_i18n', 'country_code');
select col_hasnt_default('country_i18n', 'country_code');
select has_column('country_i18n', 'lang_tag');
select col_is_fk('country_i18n', 'lang_tag');
select fk_ok('country_i18n', 'lang_tag', 'language', 'lang_tag');
select col_type_is('country_i18n', 'lang_tag', 'text');
select col_not_null('country_i18n', 'lang_tag');
select col_hasnt_default('country_i18n', 'lang_tag');
select has_column('country_i18n', 'name');
select col_type_is('country_i18n', 'name', 'text');
select col_not_null('country_i18n', 'name');
select col_hasnt_default('country_i18n', 'name');
select *
from finish();
rollback;

View File

@ -33,6 +33,10 @@ select col_not_null('currency', 'decimal_digits');
select col_has_default('currency', 'decimal_digits');
select col_default_is('currency', 'decimal_digits', 2);
set client_min_messages to warning;
truncate currency cascade;
reset client_min_messages;
select finish();
rollback;

View File

@ -1,756 +0,0 @@
-- Verify numerus:available_countries on pg
begin;
set search_path to numerus;
select 1 / count(*) from country where country_code = 'AF' and name = 'Afghanistan';
select 1 / count(*) from country where country_code = 'AX' and name = 'Åland Islands';
select 1 / count(*) from country where country_code = 'AL' and name = 'Albania';
select 1 / count(*) from country where country_code = 'DZ' and name = 'Algeria';
select 1 / count(*) from country where country_code = 'AS' and name = 'American Samoa';
select 1 / count(*) from country where country_code = 'AD' and name = 'Andorra';
select 1 / count(*) from country where country_code = 'AO' and name = 'Angola';
select 1 / count(*) from country where country_code = 'AI' and name = 'Anguilla';
select 1 / count(*) from country where country_code = 'AQ' and name = 'Antarctica';
select 1 / count(*) from country where country_code = 'AG' and name = 'Antigua and Barbuda';
select 1 / count(*) from country where country_code = 'AR' and name = 'Argentina';
select 1 / count(*) from country where country_code = 'AM' and name = 'Armenia';
select 1 / count(*) from country where country_code = 'AW' and name = 'Aruba';
select 1 / count(*) from country where country_code = 'AU' and name = 'Australia';
select 1 / count(*) from country where country_code = 'AT' and name = 'Austria';
select 1 / count(*) from country where country_code = 'AZ' and name = 'Azerbaijan';
select 1 / count(*) from country where country_code = 'BS' and name = 'Bahamas';
select 1 / count(*) from country where country_code = 'BH' and name = 'Bahrain';
select 1 / count(*) from country where country_code = 'BD' and name = 'Bangladesh';
select 1 / count(*) from country where country_code = 'BB' and name = 'Barbados';
select 1 / count(*) from country where country_code = 'BY' and name = 'Belarus';
select 1 / count(*) from country where country_code = 'BE' and name = 'Belgium';
select 1 / count(*) from country where country_code = 'PW' and name = 'Belau';
select 1 / count(*) from country where country_code = 'BZ' and name = 'Belize';
select 1 / count(*) from country where country_code = 'BJ' and name = 'Benin';
select 1 / count(*) from country where country_code = 'BM' and name = 'Bermuda';
select 1 / count(*) from country where country_code = 'BT' and name = 'Bhutan';
select 1 / count(*) from country where country_code = 'BO' and name = 'Bolivia';
select 1 / count(*) from country where country_code = 'BQ' and name = 'Bonaire, Saint Eustatius and Saba';
select 1 / count(*) from country where country_code = 'BA' and name = 'Bosnia and Herzegovina';
select 1 / count(*) from country where country_code = 'BW' and name = 'Botswana';
select 1 / count(*) from country where country_code = 'BV' and name = 'Bouvet Island';
select 1 / count(*) from country where country_code = 'BR' and name = 'Brazil';
select 1 / count(*) from country where country_code = 'IO' and name = 'British Indian Ocean Territory';
select 1 / count(*) from country where country_code = 'BN' and name = 'Brunei';
select 1 / count(*) from country where country_code = 'BG' and name = 'Bulgaria';
select 1 / count(*) from country where country_code = 'BF' and name = 'Burkina Faso';
select 1 / count(*) from country where country_code = 'BI' and name = 'Burundi';
select 1 / count(*) from country where country_code = 'KH' and name = 'Cambodia';
select 1 / count(*) from country where country_code = 'CM' and name = 'Cameroon';
select 1 / count(*) from country where country_code = 'CA' and name = 'Canada';
select 1 / count(*) from country where country_code = 'CV' and name = 'Cape Verde';
select 1 / count(*) from country where country_code = 'KY' and name = 'Cayman Islands';
select 1 / count(*) from country where country_code = 'CF' and name = 'Central African Republic';
select 1 / count(*) from country where country_code = 'TD' and name = 'Chad';
select 1 / count(*) from country where country_code = 'CL' and name = 'Chile';
select 1 / count(*) from country where country_code = 'CN' and name = 'China';
select 1 / count(*) from country where country_code = 'CX' and name = 'Christmas Island';
select 1 / count(*) from country where country_code = 'CC' and name = 'Cocos (Keeling) Islands';
select 1 / count(*) from country where country_code = 'CO' and name = 'Colombia';
select 1 / count(*) from country where country_code = 'KM' and name = 'Comoros';
select 1 / count(*) from country where country_code = 'CG' and name = 'Congo (Brazzaville)';
select 1 / count(*) from country where country_code = 'CD' and name = 'Congo (Kinshasa)';
select 1 / count(*) from country where country_code = 'CK' and name = 'Cook Islands';
select 1 / count(*) from country where country_code = 'CR' and name = 'Costa Rica';
select 1 / count(*) from country where country_code = 'HR' and name = 'Croatia';
select 1 / count(*) from country where country_code = 'CU' and name = 'Cuba';
select 1 / count(*) from country where country_code = 'CW' and name = 'Curaçao';
select 1 / count(*) from country where country_code = 'CY' and name = 'Cyprus';
select 1 / count(*) from country where country_code = 'CZ' and name = 'Czech Republic';
select 1 / count(*) from country where country_code = 'DK' and name = 'Denmark';
select 1 / count(*) from country where country_code = 'DJ' and name = 'Djibouti';
select 1 / count(*) from country where country_code = 'DM' and name = 'Dominica';
select 1 / count(*) from country where country_code = 'DO' and name = 'Dominican Republic';
select 1 / count(*) from country where country_code = 'EC' and name = 'Ecuador';
select 1 / count(*) from country where country_code = 'EG' and name = 'Egypt';
select 1 / count(*) from country where country_code = 'SV' and name = 'El Salvador';
select 1 / count(*) from country where country_code = 'GQ' and name = 'Equatorial Guinea';
select 1 / count(*) from country where country_code = 'ER' and name = 'Eritrea';
select 1 / count(*) from country where country_code = 'EE' and name = 'Estonia';
select 1 / count(*) from country where country_code = 'ET' and name = 'Ethiopia';
select 1 / count(*) from country where country_code = 'FK' and name = 'Falkland Islands';
select 1 / count(*) from country where country_code = 'FO' and name = 'Faroe Islands';
select 1 / count(*) from country where country_code = 'FJ' and name = 'Fiji';
select 1 / count(*) from country where country_code = 'FI' and name = 'Finland';
select 1 / count(*) from country where country_code = 'FR' and name = 'France';
select 1 / count(*) from country where country_code = 'GF' and name = 'French Guiana';
select 1 / count(*) from country where country_code = 'PF' and name = 'French Polynesia';
select 1 / count(*) from country where country_code = 'TF' and name = 'French Southern Territories';
select 1 / count(*) from country where country_code = 'GA' and name = 'Gabon';
select 1 / count(*) from country where country_code = 'GM' and name = 'Gambia';
select 1 / count(*) from country where country_code = 'GE' and name = 'Georgia';
select 1 / count(*) from country where country_code = 'DE' and name = 'Germany';
select 1 / count(*) from country where country_code = 'GH' and name = 'Ghana';
select 1 / count(*) from country where country_code = 'GI' and name = 'Gibraltar';
select 1 / count(*) from country where country_code = 'GR' and name = 'Greece';
select 1 / count(*) from country where country_code = 'GL' and name = 'Greenland';
select 1 / count(*) from country where country_code = 'GD' and name = 'Grenada';
select 1 / count(*) from country where country_code = 'GP' and name = 'Guadeloupe';
select 1 / count(*) from country where country_code = 'GU' and name = 'Guam';
select 1 / count(*) from country where country_code = 'GT' and name = 'Guatemala';
select 1 / count(*) from country where country_code = 'GG' and name = 'Guernsey';
select 1 / count(*) from country where country_code = 'GN' and name = 'Guinea';
select 1 / count(*) from country where country_code = 'GW' and name = 'Guinea-Bissau';
select 1 / count(*) from country where country_code = 'GY' and name = 'Guyana';
select 1 / count(*) from country where country_code = 'HT' and name = 'Haiti';
select 1 / count(*) from country where country_code = 'HM' and name = 'Heard Island and McDonald Islands';
select 1 / count(*) from country where country_code = 'HN' and name = 'Honduras';
select 1 / count(*) from country where country_code = 'HK' and name = 'Hong Kong';
select 1 / count(*) from country where country_code = 'HU' and name = 'Hungary';
select 1 / count(*) from country where country_code = 'IS' and name = 'Iceland';
select 1 / count(*) from country where country_code = 'IN' and name = 'India';
select 1 / count(*) from country where country_code = 'ID' and name = 'Indonesia';
select 1 / count(*) from country where country_code = 'IR' and name = 'Iran';
select 1 / count(*) from country where country_code = 'IQ' and name = 'Iraq';
select 1 / count(*) from country where country_code = 'IE' and name = 'Ireland';
select 1 / count(*) from country where country_code = 'IM' and name = 'Isle of Man';
select 1 / count(*) from country where country_code = 'IL' and name = 'Israel';
select 1 / count(*) from country where country_code = 'IT' and name = 'Italy';
select 1 / count(*) from country where country_code = 'CI' and name = 'Ivory Coast';
select 1 / count(*) from country where country_code = 'JM' and name = 'Jamaica';
select 1 / count(*) from country where country_code = 'JP' and name = 'Japan';
select 1 / count(*) from country where country_code = 'JE' and name = 'Jersey';
select 1 / count(*) from country where country_code = 'JO' and name = 'Jordan';
select 1 / count(*) from country where country_code = 'KZ' and name = 'Kazakhstan';
select 1 / count(*) from country where country_code = 'KE' and name = 'Kenya';
select 1 / count(*) from country where country_code = 'KI' and name = 'Kiribati';
select 1 / count(*) from country where country_code = 'KW' and name = 'Kuwait';
select 1 / count(*) from country where country_code = 'KG' and name = 'Kyrgyzstan';
select 1 / count(*) from country where country_code = 'LA' and name = 'Laos';
select 1 / count(*) from country where country_code = 'LV' and name = 'Latvia';
select 1 / count(*) from country where country_code = 'LB' and name = 'Lebanon';
select 1 / count(*) from country where country_code = 'LS' and name = 'Lesotho';
select 1 / count(*) from country where country_code = 'LR' and name = 'Liberia';
select 1 / count(*) from country where country_code = 'LY' and name = 'Libya';
select 1 / count(*) from country where country_code = 'LI' and name = 'Liechtenstein';
select 1 / count(*) from country where country_code = 'LT' and name = 'Lithuania';
select 1 / count(*) from country where country_code = 'LU' and name = 'Luxembourg';
select 1 / count(*) from country where country_code = 'MO' and name = 'Macao';
select 1 / count(*) from country where country_code = 'MK' and name = 'North Macedonia';
select 1 / count(*) from country where country_code = 'MG' and name = 'Madagascar';
select 1 / count(*) from country where country_code = 'MW' and name = 'Malawi';
select 1 / count(*) from country where country_code = 'MY' and name = 'Malaysia';
select 1 / count(*) from country where country_code = 'MV' and name = 'Maldives';
select 1 / count(*) from country where country_code = 'ML' and name = 'Mali';
select 1 / count(*) from country where country_code = 'MT' and name = 'Malta';
select 1 / count(*) from country where country_code = 'MH' and name = 'Marshall Islands';
select 1 / count(*) from country where country_code = 'MQ' and name = 'Martinique';
select 1 / count(*) from country where country_code = 'MR' and name = 'Mauritania';
select 1 / count(*) from country where country_code = 'MU' and name = 'Mauritius';
select 1 / count(*) from country where country_code = 'YT' and name = 'Mayotte';
select 1 / count(*) from country where country_code = 'MX' and name = 'Mexico';
select 1 / count(*) from country where country_code = 'FM' and name = 'Micronesia';
select 1 / count(*) from country where country_code = 'MD' and name = 'Moldova';
select 1 / count(*) from country where country_code = 'MC' and name = 'Monaco';
select 1 / count(*) from country where country_code = 'MN' and name = 'Mongolia';
select 1 / count(*) from country where country_code = 'ME' and name = 'Montenegro';
select 1 / count(*) from country where country_code = 'MS' and name = 'Montserrat';
select 1 / count(*) from country where country_code = 'MA' and name = 'Morocco';
select 1 / count(*) from country where country_code = 'MZ' and name = 'Mozambique';
select 1 / count(*) from country where country_code = 'MM' and name = 'Myanmar';
select 1 / count(*) from country where country_code = 'NA' and name = 'Namibia';
select 1 / count(*) from country where country_code = 'NR' and name = 'Nauru';
select 1 / count(*) from country where country_code = 'NP' and name = 'Nepal';
select 1 / count(*) from country where country_code = 'NL' and name = 'Netherlands';
select 1 / count(*) from country where country_code = 'NC' and name = 'New Caledonia';
select 1 / count(*) from country where country_code = 'NZ' and name = 'New Zealand';
select 1 / count(*) from country where country_code = 'NI' and name = 'Nicaragua';
select 1 / count(*) from country where country_code = 'NE' and name = 'Niger';
select 1 / count(*) from country where country_code = 'NG' and name = 'Nigeria';
select 1 / count(*) from country where country_code = 'NU' and name = 'Niue';
select 1 / count(*) from country where country_code = 'NF' and name = 'Norfolk Island';
select 1 / count(*) from country where country_code = 'MP' and name = 'Northern Mariana Islands';
select 1 / count(*) from country where country_code = 'KP' and name = 'North Korea';
select 1 / count(*) from country where country_code = 'NO' and name = 'Norway';
select 1 / count(*) from country where country_code = 'OM' and name = 'Oman';
select 1 / count(*) from country where country_code = 'PK' and name = 'Pakistan';
select 1 / count(*) from country where country_code = 'PS' and name = 'Palestinian Territory';
select 1 / count(*) from country where country_code = 'PA' and name = 'Panama';
select 1 / count(*) from country where country_code = 'PG' and name = 'Papua New Guinea';
select 1 / count(*) from country where country_code = 'PY' and name = 'Paraguay';
select 1 / count(*) from country where country_code = 'PE' and name = 'Peru';
select 1 / count(*) from country where country_code = 'PH' and name = 'Philippines';
select 1 / count(*) from country where country_code = 'PN' and name = 'Pitcairn';
select 1 / count(*) from country where country_code = 'PL' and name = 'Poland';
select 1 / count(*) from country where country_code = 'PT' and name = 'Portugal';
select 1 / count(*) from country where country_code = 'PR' and name = 'Puerto Rico';
select 1 / count(*) from country where country_code = 'QA' and name = 'Qatar';
select 1 / count(*) from country where country_code = 'RE' and name = 'Reunion';
select 1 / count(*) from country where country_code = 'RO' and name = 'Romania';
select 1 / count(*) from country where country_code = 'RU' and name = 'Russia';
select 1 / count(*) from country where country_code = 'RW' and name = 'Rwanda';
select 1 / count(*) from country where country_code = 'BL' and name = 'Saint Barthélemy';
select 1 / count(*) from country where country_code = 'SH' and name = 'Saint Helena';
select 1 / count(*) from country where country_code = 'KN' and name = 'Saint Kitts and Nevis';
select 1 / count(*) from country where country_code = 'LC' and name = 'Saint Lucia';
select 1 / count(*) from country where country_code = 'MF' and name = 'Saint Martin (French part)';
select 1 / count(*) from country where country_code = 'SX' and name = 'Saint Martin (Dutch part)';
select 1 / count(*) from country where country_code = 'PM' and name = 'Saint Pierre and Miquelon';
select 1 / count(*) from country where country_code = 'VC' and name = 'Saint Vincent and the Grenadines';
select 1 / count(*) from country where country_code = 'SM' and name = 'San Marino';
select 1 / count(*) from country where country_code = 'ST' and name = 'São Tomé and Príncipe';
select 1 / count(*) from country where country_code = 'SA' and name = 'Saudi Arabia';
select 1 / count(*) from country where country_code = 'SN' and name = 'Senegal';
select 1 / count(*) from country where country_code = 'RS' and name = 'Serbia';
select 1 / count(*) from country where country_code = 'SC' and name = 'Seychelles';
select 1 / count(*) from country where country_code = 'SL' and name = 'Sierra Leone';
select 1 / count(*) from country where country_code = 'SG' and name = 'Singapore';
select 1 / count(*) from country where country_code = 'SK' and name = 'Slovakia';
select 1 / count(*) from country where country_code = 'SI' and name = 'Slovenia';
select 1 / count(*) from country where country_code = 'SB' and name = 'Solomon Islands';
select 1 / count(*) from country where country_code = 'SO' and name = 'Somalia';
select 1 / count(*) from country where country_code = 'ZA' and name = 'South Africa';
select 1 / count(*) from country where country_code = 'GS' and name = 'South Georgia/Sandwich Islands';
select 1 / count(*) from country where country_code = 'KR' and name = 'South Korea';
select 1 / count(*) from country where country_code = 'SS' and name = 'South Sudan';
select 1 / count(*) from country where country_code = 'ES' and name = 'Spain';
select 1 / count(*) from country where country_code = 'LK' and name = 'Sri Lanka';
select 1 / count(*) from country where country_code = 'SD' and name = 'Sudan';
select 1 / count(*) from country where country_code = 'SR' and name = 'Suriname';
select 1 / count(*) from country where country_code = 'SJ' and name = 'Svalbard and Jan Mayen';
select 1 / count(*) from country where country_code = 'SZ' and name = 'Eswatini';
select 1 / count(*) from country where country_code = 'SE' and name = 'Sweden';
select 1 / count(*) from country where country_code = 'CH' and name = 'Switzerland';
select 1 / count(*) from country where country_code = 'SY' and name = 'Syria';
select 1 / count(*) from country where country_code = 'TW' and name = 'Taiwan';
select 1 / count(*) from country where country_code = 'TJ' and name = 'Tajikistan';
select 1 / count(*) from country where country_code = 'TZ' and name = 'Tanzania';
select 1 / count(*) from country where country_code = 'TH' and name = 'Thailand';
select 1 / count(*) from country where country_code = 'TL' and name = 'Timor-Leste';
select 1 / count(*) from country where country_code = 'TG' and name = 'Togo';
select 1 / count(*) from country where country_code = 'TK' and name = 'Tokelau';
select 1 / count(*) from country where country_code = 'TO' and name = 'Tonga';
select 1 / count(*) from country where country_code = 'TT' and name = 'Trinidad and Tobago';
select 1 / count(*) from country where country_code = 'TN' and name = 'Tunisia';
select 1 / count(*) from country where country_code = 'TR' and name = 'Turkey';
select 1 / count(*) from country where country_code = 'TM' and name = 'Turkmenistan';
select 1 / count(*) from country where country_code = 'TC' and name = 'Turks and Caicos Islands';
select 1 / count(*) from country where country_code = 'TV' and name = 'Tuvalu';
select 1 / count(*) from country where country_code = 'UG' and name = 'Uganda';
select 1 / count(*) from country where country_code = 'UA' and name = 'Ukraine';
select 1 / count(*) from country where country_code = 'AE' and name = 'United Arab Emirates';
select 1 / count(*) from country where country_code = 'GB' and name = 'United Kingdom (UK)';
select 1 / count(*) from country where country_code = 'US' and name = 'United States (US)';
select 1 / count(*) from country where country_code = 'UM' and name = 'United States (US) Minor Outlying Islands';
select 1 / count(*) from country where country_code = 'UY' and name = 'Uruguay';
select 1 / count(*) from country where country_code = 'UZ' and name = 'Uzbekistan';
select 1 / count(*) from country where country_code = 'VU' and name = 'Vanuatu';
select 1 / count(*) from country where country_code = 'VA' and name = 'Vatican';
select 1 / count(*) from country where country_code = 'VE' and name = 'Venezuela';
select 1 / count(*) from country where country_code = 'VN' and name = 'Vietnam';
select 1 / count(*) from country where country_code = 'VG' and name = 'Virgin Islands (British)';
select 1 / count(*) from country where country_code = 'VI' and name = 'Virgin Islands (US)';
select 1 / count(*) from country where country_code = 'WF' and name = 'Wallis and Futuna';
select 1 / count(*) from country where country_code = 'EH' and name = 'Western Sahara';
select 1 / count(*) from country where country_code = 'WS' and name = 'Samoa';
select 1 / count(*) from country where country_code = 'YE' and name = 'Yemen';
select 1 / count(*) from country where country_code = 'ZM' and name = 'Zambia';
select 1 / count(*) from country where country_code = 'ZW' and name = 'Zimbabwe';
select 1 / count(*) from country_i18n where country_code = 'AD' and lang_tag = 'ca' and name = 'Andorra';
select 1 / count(*) from country_i18n where country_code = 'AD' and lang_tag = 'es' and name = 'Andorra';
select 1 / count(*) from country_i18n where country_code = 'AE' and lang_tag = 'ca' and name = 'Emirats Àrabs Units';
select 1 / count(*) from country_i18n where country_code = 'AE' and lang_tag = 'es' and name = 'Emiratos Árabes Unidos';
select 1 / count(*) from country_i18n where country_code = 'AF' and lang_tag = 'ca' and name = 'Afganistan';
select 1 / count(*) from country_i18n where country_code = 'AF' and lang_tag = 'es' and name = 'Afganistán';
select 1 / count(*) from country_i18n where country_code = 'AG' and lang_tag = 'ca' and name = 'Antigua i Barbuda';
select 1 / count(*) from country_i18n where country_code = 'AG' and lang_tag = 'es' and name = 'Antigua y Barbuda';
select 1 / count(*) from country_i18n where country_code = 'AI' and lang_tag = 'ca' and name = 'Anguilla';
select 1 / count(*) from country_i18n where country_code = 'AI' and lang_tag = 'es' and name = 'Anguilla';
select 1 / count(*) from country_i18n where country_code = 'AL' and lang_tag = 'ca' and name = 'Albània';
select 1 / count(*) from country_i18n where country_code = 'AL' and lang_tag = 'es' and name = 'Albania';
select 1 / count(*) from country_i18n where country_code = 'AM' and lang_tag = 'ca' and name = 'Armènia';
select 1 / count(*) from country_i18n where country_code = 'AM' and lang_tag = 'es' and name = 'Armenia';
select 1 / count(*) from country_i18n where country_code = 'AO' and lang_tag = 'ca' and name = 'Angola';
select 1 / count(*) from country_i18n where country_code = 'AO' and lang_tag = 'es' and name = 'Angola';
select 1 / count(*) from country_i18n where country_code = 'AQ' and lang_tag = 'ca' and name = 'Antàrtida';
select 1 / count(*) from country_i18n where country_code = 'AQ' and lang_tag = 'es' and name = 'Antártida';
select 1 / count(*) from country_i18n where country_code = 'AR' and lang_tag = 'ca' and name = 'Argentina';
select 1 / count(*) from country_i18n where country_code = 'AR' and lang_tag = 'es' and name = 'Argentina';
select 1 / count(*) from country_i18n where country_code = 'AS' and lang_tag = 'ca' and name = 'Samoa Nord-americana';
select 1 / count(*) from country_i18n where country_code = 'AS' and lang_tag = 'es' and name = 'Samoa Americana';
select 1 / count(*) from country_i18n where country_code = 'AT' and lang_tag = 'ca' and name = 'Àustria';
select 1 / count(*) from country_i18n where country_code = 'AT' and lang_tag = 'es' and name = 'Austria';
select 1 / count(*) from country_i18n where country_code = 'AU' and lang_tag = 'ca' and name = 'Austràlia';
select 1 / count(*) from country_i18n where country_code = 'AU' and lang_tag = 'es' and name = 'Australia';
select 1 / count(*) from country_i18n where country_code = 'AW' and lang_tag = 'ca' and name = 'Aruba';
select 1 / count(*) from country_i18n where country_code = 'AW' and lang_tag = 'es' and name = 'Aruba';
select 1 / count(*) from country_i18n where country_code = 'AX' and lang_tag = 'ca' and name = 'Illes Åland';
select 1 / count(*) from country_i18n where country_code = 'AX' and lang_tag = 'es' and name = 'Islas Åland';
select 1 / count(*) from country_i18n where country_code = 'AZ' and lang_tag = 'ca' and name = 'Azerbaidjan';
select 1 / count(*) from country_i18n where country_code = 'AZ' and lang_tag = 'es' and name = 'Azerbaijan';
select 1 / count(*) from country_i18n where country_code = 'BA' and lang_tag = 'ca' and name = 'Bòsnia i Hercegovina';
select 1 / count(*) from country_i18n where country_code = 'BA' and lang_tag = 'es' and name = 'Bosnia y Herzegovina';
select 1 / count(*) from country_i18n where country_code = 'BB' and lang_tag = 'ca' and name = 'Barbados';
select 1 / count(*) from country_i18n where country_code = 'BB' and lang_tag = 'es' and name = 'Barbados';
select 1 / count(*) from country_i18n where country_code = 'BD' and lang_tag = 'ca' and name = 'Bangladesh';
select 1 / count(*) from country_i18n where country_code = 'BD' and lang_tag = 'es' and name = 'Bangladesh';
select 1 / count(*) from country_i18n where country_code = 'BE' and lang_tag = 'ca' and name = 'Bèlgica';
select 1 / count(*) from country_i18n where country_code = 'BE' and lang_tag = 'es' and name = 'Bélgica';
select 1 / count(*) from country_i18n where country_code = 'BF' and lang_tag = 'ca' and name = 'Burkina Fasso';
select 1 / count(*) from country_i18n where country_code = 'BF' and lang_tag = 'es' and name = 'Burkina Faso';
select 1 / count(*) from country_i18n where country_code = 'BG' and lang_tag = 'ca' and name = 'Bulgària';
select 1 / count(*) from country_i18n where country_code = 'BG' and lang_tag = 'es' and name = 'Bulgaria';
select 1 / count(*) from country_i18n where country_code = 'BH' and lang_tag = 'ca' and name = 'Bahrain';
select 1 / count(*) from country_i18n where country_code = 'BH' and lang_tag = 'es' and name = 'Bahrain';
select 1 / count(*) from country_i18n where country_code = 'BI' and lang_tag = 'ca' and name = 'Burundi';
select 1 / count(*) from country_i18n where country_code = 'BI' and lang_tag = 'es' and name = 'Burundi';
select 1 / count(*) from country_i18n where country_code = 'BJ' and lang_tag = 'ca' and name = 'Benín';
select 1 / count(*) from country_i18n where country_code = 'BJ' and lang_tag = 'es' and name = 'Benin';
select 1 / count(*) from country_i18n where country_code = 'BL' and lang_tag = 'ca' and name = 'Saint-Barthélemy';
select 1 / count(*) from country_i18n where country_code = 'BL' and lang_tag = 'es' and name = 'San Bartolomé';
select 1 / count(*) from country_i18n where country_code = 'BM' and lang_tag = 'ca' and name = 'Bermuda';
select 1 / count(*) from country_i18n where country_code = 'BM' and lang_tag = 'es' and name = 'Bermuda';
select 1 / count(*) from country_i18n where country_code = 'BN' and lang_tag = 'ca' and name = 'Brunei';
select 1 / count(*) from country_i18n where country_code = 'BN' and lang_tag = 'es' and name = 'Brunéi';
select 1 / count(*) from country_i18n where country_code = 'BO' and lang_tag = 'ca' and name = 'Bolívia';
select 1 / count(*) from country_i18n where country_code = 'BO' and lang_tag = 'es' and name = 'Bolivia';
select 1 / count(*) from country_i18n where country_code = 'BQ' and lang_tag = 'ca' and name = 'Bonaire, Saint Eustatius and Saba';
select 1 / count(*) from country_i18n where country_code = 'BQ' and lang_tag = 'es' and name = 'Bonaire, San Eustaquio y Saba';
select 1 / count(*) from country_i18n where country_code = 'BR' and lang_tag = 'ca' and name = 'Brasil';
select 1 / count(*) from country_i18n where country_code = 'BR' and lang_tag = 'es' and name = 'Brasil';
select 1 / count(*) from country_i18n where country_code = 'BS' and lang_tag = 'ca' and name = 'Bahames';
select 1 / count(*) from country_i18n where country_code = 'BS' and lang_tag = 'es' and name = 'Bahamas';
select 1 / count(*) from country_i18n where country_code = 'BT' and lang_tag = 'ca' and name = 'Bhutan';
select 1 / count(*) from country_i18n where country_code = 'BT' and lang_tag = 'es' and name = 'Bhutan';
select 1 / count(*) from country_i18n where country_code = 'BV' and lang_tag = 'ca' and name = 'Illa Bouvet';
select 1 / count(*) from country_i18n where country_code = 'BV' and lang_tag = 'es' and name = 'Isla Bouvet';
select 1 / count(*) from country_i18n where country_code = 'BW' and lang_tag = 'ca' and name = 'Botswana';
select 1 / count(*) from country_i18n where country_code = 'BW' and lang_tag = 'es' and name = 'Botswana';
select 1 / count(*) from country_i18n where country_code = 'BY' and lang_tag = 'ca' and name = 'Bielorússia';
select 1 / count(*) from country_i18n where country_code = 'BY' and lang_tag = 'es' and name = 'Bielorrusia';
select 1 / count(*) from country_i18n where country_code = 'BZ' and lang_tag = 'ca' and name = 'Belize';
select 1 / count(*) from country_i18n where country_code = 'BZ' and lang_tag = 'es' and name = 'Belize';
select 1 / count(*) from country_i18n where country_code = 'CA' and lang_tag = 'ca' and name = 'Canadà';
select 1 / count(*) from country_i18n where country_code = 'CA' and lang_tag = 'es' and name = 'Canadá';
select 1 / count(*) from country_i18n where country_code = 'CC' and lang_tag = 'ca' and name = 'Illes Cocos (Keeling)';
select 1 / count(*) from country_i18n where country_code = 'CC' and lang_tag = 'es' and name = 'Islas Cocos';
select 1 / count(*) from country_i18n where country_code = 'CD' and lang_tag = 'ca' and name = 'Congo (Kinshasa)';
select 1 / count(*) from country_i18n where country_code = 'CD' and lang_tag = 'es' and name = 'Congo (Kinshasa)';
select 1 / count(*) from country_i18n where country_code = 'CF' and lang_tag = 'ca' and name = 'República Centreafricana';
select 1 / count(*) from country_i18n where country_code = 'CF' and lang_tag = 'es' and name = 'República Centroafricana';
select 1 / count(*) from country_i18n where country_code = 'CG' and lang_tag = 'ca' and name = 'Congo (Brazzaville)';
select 1 / count(*) from country_i18n where country_code = 'CG' and lang_tag = 'es' and name = 'Congo (Brazzaville)';
select 1 / count(*) from country_i18n where country_code = 'CH' and lang_tag = 'ca' and name = 'Suïssa';
select 1 / count(*) from country_i18n where country_code = 'CH' and lang_tag = 'es' and name = 'Suiza';
select 1 / count(*) from country_i18n where country_code = 'CI' and lang_tag = 'ca' and name = 'Costa dIvori';
select 1 / count(*) from country_i18n where country_code = 'CI' and lang_tag = 'es' and name = 'Costa de Marfil';
select 1 / count(*) from country_i18n where country_code = 'CK' and lang_tag = 'ca' and name = 'Illes Cook';
select 1 / count(*) from country_i18n where country_code = 'CK' and lang_tag = 'es' and name = 'Islas Cook';
select 1 / count(*) from country_i18n where country_code = 'CL' and lang_tag = 'ca' and name = 'Xile';
select 1 / count(*) from country_i18n where country_code = 'CL' and lang_tag = 'es' and name = 'Chile';
select 1 / count(*) from country_i18n where country_code = 'CM' and lang_tag = 'ca' and name = 'Camerun';
select 1 / count(*) from country_i18n where country_code = 'CM' and lang_tag = 'es' and name = 'Camerún';
select 1 / count(*) from country_i18n where country_code = 'CN' and lang_tag = 'ca' and name = 'Xina';
select 1 / count(*) from country_i18n where country_code = 'CN' and lang_tag = 'es' and name = 'China';
select 1 / count(*) from country_i18n where country_code = 'CO' and lang_tag = 'ca' and name = 'Colòmbia';
select 1 / count(*) from country_i18n where country_code = 'CO' and lang_tag = 'es' and name = 'Colombia';
select 1 / count(*) from country_i18n where country_code = 'CR' and lang_tag = 'ca' and name = 'Costa Rica';
select 1 / count(*) from country_i18n where country_code = 'CR' and lang_tag = 'es' and name = 'Costa Rica';
select 1 / count(*) from country_i18n where country_code = 'CU' and lang_tag = 'ca' and name = 'Cuba';
select 1 / count(*) from country_i18n where country_code = 'CU' and lang_tag = 'es' and name = 'Cuba';
select 1 / count(*) from country_i18n where country_code = 'CV' and lang_tag = 'ca' and name = 'Cap Verd';
select 1 / count(*) from country_i18n where country_code = 'CV' and lang_tag = 'es' and name = 'Cabo Verde';
select 1 / count(*) from country_i18n where country_code = 'CW' and lang_tag = 'ca' and name = 'Curaçao';
select 1 / count(*) from country_i18n where country_code = 'CW' and lang_tag = 'es' and name = 'Curaçao';
select 1 / count(*) from country_i18n where country_code = 'CX' and lang_tag = 'ca' and name = 'Illa Christmas';
select 1 / count(*) from country_i18n where country_code = 'CX' and lang_tag = 'es' and name = 'Isla de Navidad';
select 1 / count(*) from country_i18n where country_code = 'CY' and lang_tag = 'ca' and name = 'Xipre';
select 1 / count(*) from country_i18n where country_code = 'CY' and lang_tag = 'es' and name = 'Chipre';
select 1 / count(*) from country_i18n where country_code = 'CZ' and lang_tag = 'ca' and name = 'República Txeca';
select 1 / count(*) from country_i18n where country_code = 'CZ' and lang_tag = 'es' and name = 'República Checa';
select 1 / count(*) from country_i18n where country_code = 'DE' and lang_tag = 'ca' and name = 'Alemanya';
select 1 / count(*) from country_i18n where country_code = 'DE' and lang_tag = 'es' and name = 'Alemania';
select 1 / count(*) from country_i18n where country_code = 'DJ' and lang_tag = 'ca' and name = 'Djibouti';
select 1 / count(*) from country_i18n where country_code = 'DJ' and lang_tag = 'es' and name = 'Djibouti';
select 1 / count(*) from country_i18n where country_code = 'DK' and lang_tag = 'ca' and name = 'Dinamarca';
select 1 / count(*) from country_i18n where country_code = 'DK' and lang_tag = 'es' and name = 'Dinamarca';
select 1 / count(*) from country_i18n where country_code = 'DM' and lang_tag = 'ca' and name = 'Dominica';
select 1 / count(*) from country_i18n where country_code = 'DM' and lang_tag = 'es' and name = 'Dominica';
select 1 / count(*) from country_i18n where country_code = 'DO' and lang_tag = 'ca' and name = 'República Dominicana';
select 1 / count(*) from country_i18n where country_code = 'DO' and lang_tag = 'es' and name = 'República Dominicana';
select 1 / count(*) from country_i18n where country_code = 'DZ' and lang_tag = 'ca' and name = 'Algèria';
select 1 / count(*) from country_i18n where country_code = 'DZ' and lang_tag = 'es' and name = 'Argelia';
select 1 / count(*) from country_i18n where country_code = 'EC' and lang_tag = 'ca' and name = 'Equador';
select 1 / count(*) from country_i18n where country_code = 'EC' and lang_tag = 'es' and name = 'Ecuador';
select 1 / count(*) from country_i18n where country_code = 'EE' and lang_tag = 'ca' and name = 'Estònia';
select 1 / count(*) from country_i18n where country_code = 'EE' and lang_tag = 'es' and name = 'Estonia';
select 1 / count(*) from country_i18n where country_code = 'EG' and lang_tag = 'ca' and name = 'Egipte';
select 1 / count(*) from country_i18n where country_code = 'EG' and lang_tag = 'es' and name = 'Egipto';
select 1 / count(*) from country_i18n where country_code = 'EH' and lang_tag = 'ca' and name = 'Sàhara Occidental';
select 1 / count(*) from country_i18n where country_code = 'EH' and lang_tag = 'es' and name = 'Sahara Occidental';
select 1 / count(*) from country_i18n where country_code = 'ER' and lang_tag = 'ca' and name = 'Eritrea';
select 1 / count(*) from country_i18n where country_code = 'ER' and lang_tag = 'es' and name = 'Eritrea';
select 1 / count(*) from country_i18n where country_code = 'ES' and lang_tag = 'ca' and name = 'Espanya';
select 1 / count(*) from country_i18n where country_code = 'ES' and lang_tag = 'es' and name = 'España';
select 1 / count(*) from country_i18n where country_code = 'ET' and lang_tag = 'ca' and name = 'Etiòpia';
select 1 / count(*) from country_i18n where country_code = 'ET' and lang_tag = 'es' and name = 'Etiopía';
select 1 / count(*) from country_i18n where country_code = 'FI' and lang_tag = 'ca' and name = 'Finlàndia';
select 1 / count(*) from country_i18n where country_code = 'FI' and lang_tag = 'es' and name = 'Finlandia';
select 1 / count(*) from country_i18n where country_code = 'FJ' and lang_tag = 'ca' and name = 'Fiji';
select 1 / count(*) from country_i18n where country_code = 'FJ' and lang_tag = 'es' and name = 'Fiyi';
select 1 / count(*) from country_i18n where country_code = 'FK' and lang_tag = 'ca' and name = 'Illes Falkland';
select 1 / count(*) from country_i18n where country_code = 'FK' and lang_tag = 'es' and name = 'Islas Malvinas';
select 1 / count(*) from country_i18n where country_code = 'FM' and lang_tag = 'ca' and name = 'Micronèsia';
select 1 / count(*) from country_i18n where country_code = 'FM' and lang_tag = 'es' and name = 'Micronesia';
select 1 / count(*) from country_i18n where country_code = 'FO' and lang_tag = 'ca' and name = 'Illes Faroe';
select 1 / count(*) from country_i18n where country_code = 'FO' and lang_tag = 'es' and name = 'Islas Feroe';
select 1 / count(*) from country_i18n where country_code = 'FR' and lang_tag = 'ca' and name = 'França';
select 1 / count(*) from country_i18n where country_code = 'FR' and lang_tag = 'es' and name = 'Francia';
select 1 / count(*) from country_i18n where country_code = 'GA' and lang_tag = 'ca' and name = 'Gabon';
select 1 / count(*) from country_i18n where country_code = 'GA' and lang_tag = 'es' and name = 'Gabón';
select 1 / count(*) from country_i18n where country_code = 'GB' and lang_tag = 'ca' and name = 'Regne Unit (UK)';
select 1 / count(*) from country_i18n where country_code = 'GB' and lang_tag = 'es' and name = 'Reino Unido (UK)';
select 1 / count(*) from country_i18n where country_code = 'GD' and lang_tag = 'ca' and name = 'Grenada';
select 1 / count(*) from country_i18n where country_code = 'GD' and lang_tag = 'es' and name = 'Granada';
select 1 / count(*) from country_i18n where country_code = 'GE' and lang_tag = 'ca' and name = 'Geòrgia';
select 1 / count(*) from country_i18n where country_code = 'GE' and lang_tag = 'es' and name = 'Georgia';
select 1 / count(*) from country_i18n where country_code = 'GF' and lang_tag = 'ca' and name = 'Guaiana Francesa';
select 1 / count(*) from country_i18n where country_code = 'GF' and lang_tag = 'es' and name = 'Guayana Francesa';
select 1 / count(*) from country_i18n where country_code = 'GG' and lang_tag = 'ca' and name = 'Guernsey';
select 1 / count(*) from country_i18n where country_code = 'GG' and lang_tag = 'es' and name = 'Guernsey';
select 1 / count(*) from country_i18n where country_code = 'GH' and lang_tag = 'ca' and name = 'Ghana';
select 1 / count(*) from country_i18n where country_code = 'GH' and lang_tag = 'es' and name = 'Ghana';
select 1 / count(*) from country_i18n where country_code = 'GI' and lang_tag = 'ca' and name = 'Gibraltar';
select 1 / count(*) from country_i18n where country_code = 'GI' and lang_tag = 'es' and name = 'Gibraltar';
select 1 / count(*) from country_i18n where country_code = 'GL' and lang_tag = 'ca' and name = 'Groenlàndia';
select 1 / count(*) from country_i18n where country_code = 'GL' and lang_tag = 'es' and name = 'Groenlandia';
select 1 / count(*) from country_i18n where country_code = 'GM' and lang_tag = 'ca' and name = 'Gàmbia';
select 1 / count(*) from country_i18n where country_code = 'GM' and lang_tag = 'es' and name = 'Gambia';
select 1 / count(*) from country_i18n where country_code = 'GN' and lang_tag = 'ca' and name = 'Guinea';
select 1 / count(*) from country_i18n where country_code = 'GN' and lang_tag = 'es' and name = 'Guinea';
select 1 / count(*) from country_i18n where country_code = 'GP' and lang_tag = 'ca' and name = 'Guadalupe';
select 1 / count(*) from country_i18n where country_code = 'GP' and lang_tag = 'es' and name = 'Guadalupe';
select 1 / count(*) from country_i18n where country_code = 'GQ' and lang_tag = 'ca' and name = 'Guinea Equatorial';
select 1 / count(*) from country_i18n where country_code = 'GQ' and lang_tag = 'es' and name = 'Guinea Ecuatorial';
select 1 / count(*) from country_i18n where country_code = 'GR' and lang_tag = 'ca' and name = 'Grècia';
select 1 / count(*) from country_i18n where country_code = 'GR' and lang_tag = 'es' and name = 'Grecia';
select 1 / count(*) from country_i18n where country_code = 'GS' and lang_tag = 'ca' and name = 'Illes Geòrgia del Sud i Sandwich del Sud';
select 1 / count(*) from country_i18n where country_code = 'GS' and lang_tag = 'es' and name = 'Islas Georgias y Sandwich del Sur';
select 1 / count(*) from country_i18n where country_code = 'GT' and lang_tag = 'ca' and name = 'Guatemala';
select 1 / count(*) from country_i18n where country_code = 'GT' and lang_tag = 'es' and name = 'Guatemala';
select 1 / count(*) from country_i18n where country_code = 'GU' and lang_tag = 'ca' and name = 'Guam';
select 1 / count(*) from country_i18n where country_code = 'GU' and lang_tag = 'es' and name = 'Guam';
select 1 / count(*) from country_i18n where country_code = 'GW' and lang_tag = 'ca' and name = 'Guinea Bissau';
select 1 / count(*) from country_i18n where country_code = 'GW' and lang_tag = 'es' and name = 'Guinea-Bisáu';
select 1 / count(*) from country_i18n where country_code = 'GY' and lang_tag = 'ca' and name = 'Guyana';
select 1 / count(*) from country_i18n where country_code = 'GY' and lang_tag = 'es' and name = 'Guyana';
select 1 / count(*) from country_i18n where country_code = 'HK' and lang_tag = 'ca' and name = 'Hong Kong';
select 1 / count(*) from country_i18n where country_code = 'HK' and lang_tag = 'es' and name = 'Hong Kong';
select 1 / count(*) from country_i18n where country_code = 'HM' and lang_tag = 'ca' and name = 'Illes Heard i McDonald';
select 1 / count(*) from country_i18n where country_code = 'HM' and lang_tag = 'es' and name = 'Islas Heard y McDonald';
select 1 / count(*) from country_i18n where country_code = 'HN' and lang_tag = 'ca' and name = 'Hondures';
select 1 / count(*) from country_i18n where country_code = 'HN' and lang_tag = 'es' and name = 'Honduras';
select 1 / count(*) from country_i18n where country_code = 'HR' and lang_tag = 'ca' and name = 'Croàcia';
select 1 / count(*) from country_i18n where country_code = 'HR' and lang_tag = 'es' and name = 'Croacia';
select 1 / count(*) from country_i18n where country_code = 'HT' and lang_tag = 'ca' and name = 'Haití';
select 1 / count(*) from country_i18n where country_code = 'HT' and lang_tag = 'es' and name = 'Haití';
select 1 / count(*) from country_i18n where country_code = 'HU' and lang_tag = 'ca' and name = 'Hongria';
select 1 / count(*) from country_i18n where country_code = 'HU' and lang_tag = 'es' and name = 'Hungría';
select 1 / count(*) from country_i18n where country_code = 'ID' and lang_tag = 'ca' and name = 'Indonèsia';
select 1 / count(*) from country_i18n where country_code = 'ID' and lang_tag = 'es' and name = 'Indonesia';
select 1 / count(*) from country_i18n where country_code = 'IE' and lang_tag = 'ca' and name = 'Irlanda';
select 1 / count(*) from country_i18n where country_code = 'IE' and lang_tag = 'es' and name = 'Irlanda';
select 1 / count(*) from country_i18n where country_code = 'IL' and lang_tag = 'ca' and name = 'Israel';
select 1 / count(*) from country_i18n where country_code = 'IL' and lang_tag = 'es' and name = 'Israel';
select 1 / count(*) from country_i18n where country_code = 'IM' and lang_tag = 'ca' and name = 'Illa de Man';
select 1 / count(*) from country_i18n where country_code = 'IM' and lang_tag = 'es' and name = 'Isla de Man';
select 1 / count(*) from country_i18n where country_code = 'IN' and lang_tag = 'ca' and name = 'Índia';
select 1 / count(*) from country_i18n where country_code = 'IN' and lang_tag = 'es' and name = 'India';
select 1 / count(*) from country_i18n where country_code = 'IO' and lang_tag = 'ca' and name = 'Territori Britànic de lOceà Índic';
select 1 / count(*) from country_i18n where country_code = 'IO' and lang_tag = 'es' and name = 'Territorio Británico del Océano Índico';
select 1 / count(*) from country_i18n where country_code = 'IQ' and lang_tag = 'ca' and name = 'Iraq';
select 1 / count(*) from country_i18n where country_code = 'IQ' and lang_tag = 'es' and name = 'Irak';
select 1 / count(*) from country_i18n where country_code = 'IR' and lang_tag = 'ca' and name = 'Iran';
select 1 / count(*) from country_i18n where country_code = 'IR' and lang_tag = 'es' and name = 'Irán';
select 1 / count(*) from country_i18n where country_code = 'IS' and lang_tag = 'ca' and name = 'Islàndia';
select 1 / count(*) from country_i18n where country_code = 'IS' and lang_tag = 'es' and name = 'Islandia';
select 1 / count(*) from country_i18n where country_code = 'IT' and lang_tag = 'ca' and name = 'Itàlia';
select 1 / count(*) from country_i18n where country_code = 'IT' and lang_tag = 'es' and name = 'Italia';
select 1 / count(*) from country_i18n where country_code = 'JE' and lang_tag = 'ca' and name = 'Jersey';
select 1 / count(*) from country_i18n where country_code = 'JE' and lang_tag = 'es' and name = 'Jersey';
select 1 / count(*) from country_i18n where country_code = 'JM' and lang_tag = 'ca' and name = 'Jamaica';
select 1 / count(*) from country_i18n where country_code = 'JM' and lang_tag = 'es' and name = 'Jamaica';
select 1 / count(*) from country_i18n where country_code = 'JO' and lang_tag = 'ca' and name = 'Jordània';
select 1 / count(*) from country_i18n where country_code = 'JO' and lang_tag = 'es' and name = 'Jordania';
select 1 / count(*) from country_i18n where country_code = 'JP' and lang_tag = 'ca' and name = 'Japó';
select 1 / count(*) from country_i18n where country_code = 'JP' and lang_tag = 'es' and name = 'Japón';
select 1 / count(*) from country_i18n where country_code = 'KE' and lang_tag = 'ca' and name = 'Kenya';
select 1 / count(*) from country_i18n where country_code = 'KE' and lang_tag = 'es' and name = 'Kenia';
select 1 / count(*) from country_i18n where country_code = 'KG' and lang_tag = 'ca' and name = 'Kirguizistan';
select 1 / count(*) from country_i18n where country_code = 'KG' and lang_tag = 'es' and name = 'Kirguistán';
select 1 / count(*) from country_i18n where country_code = 'KH' and lang_tag = 'ca' and name = 'Cambodja';
select 1 / count(*) from country_i18n where country_code = 'KH' and lang_tag = 'es' and name = 'Camboya';
select 1 / count(*) from country_i18n where country_code = 'KI' and lang_tag = 'ca' and name = 'Kiribati';
select 1 / count(*) from country_i18n where country_code = 'KI' and lang_tag = 'es' and name = 'Kiribati';
select 1 / count(*) from country_i18n where country_code = 'KM' and lang_tag = 'ca' and name = 'Comores';
select 1 / count(*) from country_i18n where country_code = 'KM' and lang_tag = 'es' and name = 'Comoras';
select 1 / count(*) from country_i18n where country_code = 'KN' and lang_tag = 'ca' and name = 'Saint Kitts i Nevis';
select 1 / count(*) from country_i18n where country_code = 'KN' and lang_tag = 'es' and name = 'San Cristóbal y Nieves';
select 1 / count(*) from country_i18n where country_code = 'KP' and lang_tag = 'ca' and name = 'Corea del Nord';
select 1 / count(*) from country_i18n where country_code = 'KP' and lang_tag = 'es' and name = 'Corea del Norte';
select 1 / count(*) from country_i18n where country_code = 'KR' and lang_tag = 'ca' and name = 'Corea del Sud';
select 1 / count(*) from country_i18n where country_code = 'KR' and lang_tag = 'es' and name = 'Corea del Sur';
select 1 / count(*) from country_i18n where country_code = 'KW' and lang_tag = 'ca' and name = 'Kuwait';
select 1 / count(*) from country_i18n where country_code = 'KW' and lang_tag = 'es' and name = 'Kuwait';
select 1 / count(*) from country_i18n where country_code = 'KY' and lang_tag = 'ca' and name = 'Illes Caiman';
select 1 / count(*) from country_i18n where country_code = 'KY' and lang_tag = 'es' and name = 'Islas Caimán';
select 1 / count(*) from country_i18n where country_code = 'KZ' and lang_tag = 'ca' and name = 'Kazakhstan';
select 1 / count(*) from country_i18n where country_code = 'KZ' and lang_tag = 'es' and name = 'Kazajistán';
select 1 / count(*) from country_i18n where country_code = 'LA' and lang_tag = 'ca' and name = 'Laos';
select 1 / count(*) from country_i18n where country_code = 'LA' and lang_tag = 'es' and name = 'Laos';
select 1 / count(*) from country_i18n where country_code = 'LB' and lang_tag = 'ca' and name = 'Líban';
select 1 / count(*) from country_i18n where country_code = 'LB' and lang_tag = 'es' and name = 'Líbano';
select 1 / count(*) from country_i18n where country_code = 'LC' and lang_tag = 'ca' and name = 'Saint Lucia';
select 1 / count(*) from country_i18n where country_code = 'LC' and lang_tag = 'es' and name = 'Santa Lucía';
select 1 / count(*) from country_i18n where country_code = 'LI' and lang_tag = 'ca' and name = 'Liechtenstein';
select 1 / count(*) from country_i18n where country_code = 'LI' and lang_tag = 'es' and name = 'Liechtenstein';
select 1 / count(*) from country_i18n where country_code = 'LK' and lang_tag = 'ca' and name = 'Sri Lanka';
select 1 / count(*) from country_i18n where country_code = 'LK' and lang_tag = 'es' and name = 'Sri Lanka';
select 1 / count(*) from country_i18n where country_code = 'LR' and lang_tag = 'ca' and name = 'Libèria';
select 1 / count(*) from country_i18n where country_code = 'LR' and lang_tag = 'es' and name = 'Liberia';
select 1 / count(*) from country_i18n where country_code = 'LS' and lang_tag = 'ca' and name = 'Lesotho';
select 1 / count(*) from country_i18n where country_code = 'LS' and lang_tag = 'es' and name = 'Lesoto';
select 1 / count(*) from country_i18n where country_code = 'LT' and lang_tag = 'ca' and name = 'Lituània';
select 1 / count(*) from country_i18n where country_code = 'LT' and lang_tag = 'es' and name = 'Lituania';
select 1 / count(*) from country_i18n where country_code = 'LU' and lang_tag = 'ca' and name = 'Luxemburg';
select 1 / count(*) from country_i18n where country_code = 'LU' and lang_tag = 'es' and name = 'Luxemburgo';
select 1 / count(*) from country_i18n where country_code = 'LV' and lang_tag = 'ca' and name = 'Letònia';
select 1 / count(*) from country_i18n where country_code = 'LV' and lang_tag = 'es' and name = 'Letonia';
select 1 / count(*) from country_i18n where country_code = 'LY' and lang_tag = 'ca' and name = 'Líbia';
select 1 / count(*) from country_i18n where country_code = 'LY' and lang_tag = 'es' and name = 'Libia';
select 1 / count(*) from country_i18n where country_code = 'MA' and lang_tag = 'ca' and name = 'Marroc';
select 1 / count(*) from country_i18n where country_code = 'MA' and lang_tag = 'es' and name = 'Marruecos';
select 1 / count(*) from country_i18n where country_code = 'MC' and lang_tag = 'ca' and name = 'Mònaco';
select 1 / count(*) from country_i18n where country_code = 'MC' and lang_tag = 'es' and name = 'Mónaco';
select 1 / count(*) from country_i18n where country_code = 'MD' and lang_tag = 'ca' and name = 'Moldàvia';
select 1 / count(*) from country_i18n where country_code = 'MD' and lang_tag = 'es' and name = 'Moldavia';
select 1 / count(*) from country_i18n where country_code = 'ME' and lang_tag = 'ca' and name = 'Montenegro';
select 1 / count(*) from country_i18n where country_code = 'ME' and lang_tag = 'es' and name = 'Montenegro';
select 1 / count(*) from country_i18n where country_code = 'MF' and lang_tag = 'ca' and name = 'Saint Martin (part francesa)';
select 1 / count(*) from country_i18n where country_code = 'MF' and lang_tag = 'es' and name = 'San Martín (parte de Francia)';
select 1 / count(*) from country_i18n where country_code = 'MG' and lang_tag = 'ca' and name = 'Madagascar';
select 1 / count(*) from country_i18n where country_code = 'MG' and lang_tag = 'es' and name = 'Madagascar';
select 1 / count(*) from country_i18n where country_code = 'MH' and lang_tag = 'ca' and name = 'Illes Marshall';
select 1 / count(*) from country_i18n where country_code = 'MH' and lang_tag = 'es' and name = 'Islas Marshall';
select 1 / count(*) from country_i18n where country_code = 'MK' and lang_tag = 'ca' and name = 'Macedònia del Nord';
select 1 / count(*) from country_i18n where country_code = 'MK' and lang_tag = 'es' and name = 'Macedonia del Norte';
select 1 / count(*) from country_i18n where country_code = 'ML' and lang_tag = 'ca' and name = 'Mali';
select 1 / count(*) from country_i18n where country_code = 'ML' and lang_tag = 'es' and name = 'Malí';
select 1 / count(*) from country_i18n where country_code = 'MM' and lang_tag = 'ca' and name = 'Myanmar';
select 1 / count(*) from country_i18n where country_code = 'MM' and lang_tag = 'es' and name = 'Birmania';
select 1 / count(*) from country_i18n where country_code = 'MN' and lang_tag = 'ca' and name = 'Mongòlia';
select 1 / count(*) from country_i18n where country_code = 'MN' and lang_tag = 'es' and name = 'Mongolia';
select 1 / count(*) from country_i18n where country_code = 'MO' and lang_tag = 'ca' and name = 'Macau';
select 1 / count(*) from country_i18n where country_code = 'MO' and lang_tag = 'es' and name = 'Macao';
select 1 / count(*) from country_i18n where country_code = 'MP' and lang_tag = 'ca' and name = 'Illes Mariannes Septentrionals';
select 1 / count(*) from country_i18n where country_code = 'MP' and lang_tag = 'es' and name = 'Islas Marianas del Norte';
select 1 / count(*) from country_i18n where country_code = 'MQ' and lang_tag = 'ca' and name = 'Martinica';
select 1 / count(*) from country_i18n where country_code = 'MQ' and lang_tag = 'es' and name = 'Martinica';
select 1 / count(*) from country_i18n where country_code = 'MR' and lang_tag = 'ca' and name = 'Mauritània';
select 1 / count(*) from country_i18n where country_code = 'MR' and lang_tag = 'es' and name = 'Mauritania';
select 1 / count(*) from country_i18n where country_code = 'MS' and lang_tag = 'ca' and name = 'Montserrat';
select 1 / count(*) from country_i18n where country_code = 'MS' and lang_tag = 'es' and name = 'Montserrat';
select 1 / count(*) from country_i18n where country_code = 'MT' and lang_tag = 'ca' and name = 'Malta';
select 1 / count(*) from country_i18n where country_code = 'MT' and lang_tag = 'es' and name = 'Malta';
select 1 / count(*) from country_i18n where country_code = 'MU' and lang_tag = 'ca' and name = 'Maurici';
select 1 / count(*) from country_i18n where country_code = 'MU' and lang_tag = 'es' and name = 'Mauricio';
select 1 / count(*) from country_i18n where country_code = 'MV' and lang_tag = 'ca' and name = 'Maldives';
select 1 / count(*) from country_i18n where country_code = 'MV' and lang_tag = 'es' and name = 'Maldivas';
select 1 / count(*) from country_i18n where country_code = 'MW' and lang_tag = 'ca' and name = 'Malawi';
select 1 / count(*) from country_i18n where country_code = 'MW' and lang_tag = 'es' and name = 'Malaui';
select 1 / count(*) from country_i18n where country_code = 'MX' and lang_tag = 'ca' and name = 'Mèxic';
select 1 / count(*) from country_i18n where country_code = 'MX' and lang_tag = 'es' and name = 'México';
select 1 / count(*) from country_i18n where country_code = 'MY' and lang_tag = 'ca' and name = 'Malàisia';
select 1 / count(*) from country_i18n where country_code = 'MY' and lang_tag = 'es' and name = 'Malasia';
select 1 / count(*) from country_i18n where country_code = 'MZ' and lang_tag = 'ca' and name = 'Moçambic';
select 1 / count(*) from country_i18n where country_code = 'MZ' and lang_tag = 'es' and name = 'Mozambique';
select 1 / count(*) from country_i18n where country_code = 'NA' and lang_tag = 'ca' and name = 'Namíbia';
select 1 / count(*) from country_i18n where country_code = 'NA' and lang_tag = 'es' and name = 'Namibia';
select 1 / count(*) from country_i18n where country_code = 'NC' and lang_tag = 'ca' and name = 'Nova Caledònia';
select 1 / count(*) from country_i18n where country_code = 'NC' and lang_tag = 'es' and name = 'Nueva Caledonia';
select 1 / count(*) from country_i18n where country_code = 'NE' and lang_tag = 'ca' and name = 'Níger';
select 1 / count(*) from country_i18n where country_code = 'NE' and lang_tag = 'es' and name = 'Níger';
select 1 / count(*) from country_i18n where country_code = 'NF' and lang_tag = 'ca' and name = 'Illa Norfolk';
select 1 / count(*) from country_i18n where country_code = 'NF' and lang_tag = 'es' and name = 'Isla Norfolk';
select 1 / count(*) from country_i18n where country_code = 'NG' and lang_tag = 'ca' and name = 'Nigèria';
select 1 / count(*) from country_i18n where country_code = 'NG' and lang_tag = 'es' and name = 'Nigeria';
select 1 / count(*) from country_i18n where country_code = 'NI' and lang_tag = 'ca' and name = 'Nicaragua';
select 1 / count(*) from country_i18n where country_code = 'NI' and lang_tag = 'es' and name = 'Nicaragua';
select 1 / count(*) from country_i18n where country_code = 'NL' and lang_tag = 'ca' and name = 'Països Baixos';
select 1 / count(*) from country_i18n where country_code = 'NL' and lang_tag = 'es' and name = 'Países Bajos';
select 1 / count(*) from country_i18n where country_code = 'NO' and lang_tag = 'ca' and name = 'Noruega';
select 1 / count(*) from country_i18n where country_code = 'NO' and lang_tag = 'es' and name = 'Noruega';
select 1 / count(*) from country_i18n where country_code = 'NP' and lang_tag = 'ca' and name = 'Nepal';
select 1 / count(*) from country_i18n where country_code = 'NP' and lang_tag = 'es' and name = 'Nepal';
select 1 / count(*) from country_i18n where country_code = 'NR' and lang_tag = 'ca' and name = 'Nauru';
select 1 / count(*) from country_i18n where country_code = 'NR' and lang_tag = 'es' and name = 'Nauru';
select 1 / count(*) from country_i18n where country_code = 'NU' and lang_tag = 'ca' and name = 'Niue';
select 1 / count(*) from country_i18n where country_code = 'NU' and lang_tag = 'es' and name = 'Niue';
select 1 / count(*) from country_i18n where country_code = 'NZ' and lang_tag = 'ca' and name = 'Nova Zelanda';
select 1 / count(*) from country_i18n where country_code = 'NZ' and lang_tag = 'es' and name = 'Nueva Zelanda';
select 1 / count(*) from country_i18n where country_code = 'OM' and lang_tag = 'ca' and name = 'Oman';
select 1 / count(*) from country_i18n where country_code = 'OM' and lang_tag = 'es' and name = 'Omán';
select 1 / count(*) from country_i18n where country_code = 'PA' and lang_tag = 'ca' and name = 'Panamà';
select 1 / count(*) from country_i18n where country_code = 'PA' and lang_tag = 'es' and name = 'Panamá';
select 1 / count(*) from country_i18n where country_code = 'PE' and lang_tag = 'ca' and name = 'Perú';
select 1 / count(*) from country_i18n where country_code = 'PE' and lang_tag = 'es' and name = 'Perú';
select 1 / count(*) from country_i18n where country_code = 'PF' and lang_tag = 'ca' and name = 'Polinèsia Francesa';
select 1 / count(*) from country_i18n where country_code = 'PF' and lang_tag = 'es' and name = 'Polinesia Francesa';
select 1 / count(*) from country_i18n where country_code = 'PG' and lang_tag = 'ca' and name = 'Papua Nova Guinea';
select 1 / count(*) from country_i18n where country_code = 'PG' and lang_tag = 'es' and name = 'Papúa Nueva Guinea';
select 1 / count(*) from country_i18n where country_code = 'PH' and lang_tag = 'ca' and name = 'Filipines';
select 1 / count(*) from country_i18n where country_code = 'PH' and lang_tag = 'es' and name = 'Filipinas';
select 1 / count(*) from country_i18n where country_code = 'PK' and lang_tag = 'ca' and name = 'Pakistan';
select 1 / count(*) from country_i18n where country_code = 'PK' and lang_tag = 'es' and name = 'Pakistán';
select 1 / count(*) from country_i18n where country_code = 'PL' and lang_tag = 'ca' and name = 'Polònia';
select 1 / count(*) from country_i18n where country_code = 'PL' and lang_tag = 'es' and name = 'Polonia';
select 1 / count(*) from country_i18n where country_code = 'PM' and lang_tag = 'ca' and name = 'Saint-Pierre i Miquelon';
select 1 / count(*) from country_i18n where country_code = 'PM' and lang_tag = 'es' and name = 'San Pedro y Miquelón';
select 1 / count(*) from country_i18n where country_code = 'PN' and lang_tag = 'ca' and name = 'Pitcairn';
select 1 / count(*) from country_i18n where country_code = 'PN' and lang_tag = 'es' and name = 'Pitcairn';
select 1 / count(*) from country_i18n where country_code = 'PR' and lang_tag = 'ca' and name = 'Puerto Rico';
select 1 / count(*) from country_i18n where country_code = 'PR' and lang_tag = 'es' and name = 'Puerto Rico';
select 1 / count(*) from country_i18n where country_code = 'PS' and lang_tag = 'ca' and name = 'Palestina';
select 1 / count(*) from country_i18n where country_code = 'PS' and lang_tag = 'es' and name = 'Territorios Palestinos';
select 1 / count(*) from country_i18n where country_code = 'PT' and lang_tag = 'ca' and name = 'Portugal';
select 1 / count(*) from country_i18n where country_code = 'PT' and lang_tag = 'es' and name = 'Portugal';
select 1 / count(*) from country_i18n where country_code = 'PW' and lang_tag = 'ca' and name = 'Belau';
select 1 / count(*) from country_i18n where country_code = 'PW' and lang_tag = 'es' and name = 'Belau';
select 1 / count(*) from country_i18n where country_code = 'PY' and lang_tag = 'ca' and name = 'Paraguai';
select 1 / count(*) from country_i18n where country_code = 'PY' and lang_tag = 'es' and name = 'Paraguay';
select 1 / count(*) from country_i18n where country_code = 'QA' and lang_tag = 'ca' and name = 'Qatar';
select 1 / count(*) from country_i18n where country_code = 'QA' and lang_tag = 'es' and name = 'Qatar';
select 1 / count(*) from country_i18n where country_code = 'RE' and lang_tag = 'ca' and name = 'Reunió';
select 1 / count(*) from country_i18n where country_code = 'RE' and lang_tag = 'es' and name = 'Reunión';
select 1 / count(*) from country_i18n where country_code = 'RO' and lang_tag = 'ca' and name = 'Romania';
select 1 / count(*) from country_i18n where country_code = 'RO' and lang_tag = 'es' and name = 'Rumania';
select 1 / count(*) from country_i18n where country_code = 'RS' and lang_tag = 'ca' and name = 'Sèrbia';
select 1 / count(*) from country_i18n where country_code = 'RS' and lang_tag = 'es' and name = 'Serbia';
select 1 / count(*) from country_i18n where country_code = 'RU' and lang_tag = 'ca' and name = 'Rússia';
select 1 / count(*) from country_i18n where country_code = 'RU' and lang_tag = 'es' and name = 'Rusia';
select 1 / count(*) from country_i18n where country_code = 'RW' and lang_tag = 'ca' and name = 'Ruanda';
select 1 / count(*) from country_i18n where country_code = 'RW' and lang_tag = 'es' and name = 'Ruanda';
select 1 / count(*) from country_i18n where country_code = 'SA' and lang_tag = 'ca' and name = 'Aràbia Saudita';
select 1 / count(*) from country_i18n where country_code = 'SA' and lang_tag = 'es' and name = 'Arabia Saudita';
select 1 / count(*) from country_i18n where country_code = 'SB' and lang_tag = 'ca' and name = 'Illes Salomó';
select 1 / count(*) from country_i18n where country_code = 'SB' and lang_tag = 'es' and name = 'Islas Salomón';
select 1 / count(*) from country_i18n where country_code = 'SC' and lang_tag = 'ca' and name = 'Seychelles';
select 1 / count(*) from country_i18n where country_code = 'SC' and lang_tag = 'es' and name = 'Seychelles';
select 1 / count(*) from country_i18n where country_code = 'SD' and lang_tag = 'ca' and name = 'Sudan';
select 1 / count(*) from country_i18n where country_code = 'SD' and lang_tag = 'es' and name = 'Sudán';
select 1 / count(*) from country_i18n where country_code = 'SE' and lang_tag = 'ca' and name = 'Suècia';
select 1 / count(*) from country_i18n where country_code = 'SE' and lang_tag = 'es' and name = 'Suecia';
select 1 / count(*) from country_i18n where country_code = 'SG' and lang_tag = 'ca' and name = 'Singapur';
select 1 / count(*) from country_i18n where country_code = 'SG' and lang_tag = 'es' and name = 'Singapur';
select 1 / count(*) from country_i18n where country_code = 'SH' and lang_tag = 'ca' and name = 'Saint Helena';
select 1 / count(*) from country_i18n where country_code = 'SH' and lang_tag = 'es' and name = 'Isla Santa Elena';
select 1 / count(*) from country_i18n where country_code = 'SI' and lang_tag = 'ca' and name = 'Eslovènia';
select 1 / count(*) from country_i18n where country_code = 'SI' and lang_tag = 'es' and name = 'Eslovenia';
select 1 / count(*) from country_i18n where country_code = 'SJ' and lang_tag = 'ca' and name = 'Svalbard i Jan Mayen';
select 1 / count(*) from country_i18n where country_code = 'SJ' and lang_tag = 'es' and name = 'Svalbard y Jan Mayen';
select 1 / count(*) from country_i18n where country_code = 'SK' and lang_tag = 'ca' and name = 'Eslovàquia';
select 1 / count(*) from country_i18n where country_code = 'SK' and lang_tag = 'es' and name = 'Eslovaquia';
select 1 / count(*) from country_i18n where country_code = 'SL' and lang_tag = 'ca' and name = 'Sierra Leone';
select 1 / count(*) from country_i18n where country_code = 'SL' and lang_tag = 'es' and name = 'Sierra Leona';
select 1 / count(*) from country_i18n where country_code = 'SM' and lang_tag = 'ca' and name = 'San Marino';
select 1 / count(*) from country_i18n where country_code = 'SM' and lang_tag = 'es' and name = 'San Marino';
select 1 / count(*) from country_i18n where country_code = 'SN' and lang_tag = 'ca' and name = 'Senegal';
select 1 / count(*) from country_i18n where country_code = 'SN' and lang_tag = 'es' and name = 'Senegal';
select 1 / count(*) from country_i18n where country_code = 'SO' and lang_tag = 'ca' and name = 'Somàlia';
select 1 / count(*) from country_i18n where country_code = 'SO' and lang_tag = 'es' and name = 'Somalia';
select 1 / count(*) from country_i18n where country_code = 'SR' and lang_tag = 'ca' and name = 'Surinam';
select 1 / count(*) from country_i18n where country_code = 'SR' and lang_tag = 'es' and name = 'Surinam';
select 1 / count(*) from country_i18n where country_code = 'SS' and lang_tag = 'ca' and name = 'Sudan del Sud';
select 1 / count(*) from country_i18n where country_code = 'SS' and lang_tag = 'es' and name = 'Sudán del Sur';
select 1 / count(*) from country_i18n where country_code = 'ST' and lang_tag = 'ca' and name = 'São Tomé i Príncipe';
select 1 / count(*) from country_i18n where country_code = 'ST' and lang_tag = 'es' and name = 'Santo Tomé y Príncipe';
select 1 / count(*) from country_i18n where country_code = 'SV' and lang_tag = 'ca' and name = 'El Salvador';
select 1 / count(*) from country_i18n where country_code = 'SV' and lang_tag = 'es' and name = 'El Salvador';
select 1 / count(*) from country_i18n where country_code = 'SX' and lang_tag = 'ca' and name = 'Saint Martin (part holandesa)';
select 1 / count(*) from country_i18n where country_code = 'SX' and lang_tag = 'es' and name = 'San Martín (Países Bajos)';
select 1 / count(*) from country_i18n where country_code = 'SY' and lang_tag = 'ca' and name = 'Síria';
select 1 / count(*) from country_i18n where country_code = 'SY' and lang_tag = 'es' and name = 'Siria';
select 1 / count(*) from country_i18n where country_code = 'SZ' and lang_tag = 'ca' and name = 'Eswatini';
select 1 / count(*) from country_i18n where country_code = 'SZ' and lang_tag = 'es' and name = 'Esuatini';
select 1 / count(*) from country_i18n where country_code = 'TC' and lang_tag = 'ca' and name = 'Illes Turks i Caicos';
select 1 / count(*) from country_i18n where country_code = 'TC' and lang_tag = 'es' and name = 'Islas Turcas y Caicos';
select 1 / count(*) from country_i18n where country_code = 'TD' and lang_tag = 'ca' and name = 'Txad';
select 1 / count(*) from country_i18n where country_code = 'TD' and lang_tag = 'es' and name = 'Chad';
select 1 / count(*) from country_i18n where country_code = 'TF' and lang_tag = 'ca' and name = 'Terres Australs Franceses';
select 1 / count(*) from country_i18n where country_code = 'TF' and lang_tag = 'es' and name = 'Territorios australes franceses';
select 1 / count(*) from country_i18n where country_code = 'TG' and lang_tag = 'ca' and name = 'Togo';
select 1 / count(*) from country_i18n where country_code = 'TG' and lang_tag = 'es' and name = 'Togo';
select 1 / count(*) from country_i18n where country_code = 'TH' and lang_tag = 'ca' and name = 'Tailàndia';
select 1 / count(*) from country_i18n where country_code = 'TH' and lang_tag = 'es' and name = 'Tailandia';
select 1 / count(*) from country_i18n where country_code = 'TJ' and lang_tag = 'ca' and name = 'Tadjikistan';
select 1 / count(*) from country_i18n where country_code = 'TJ' and lang_tag = 'es' and name = 'Tayikistán';
select 1 / count(*) from country_i18n where country_code = 'TK' and lang_tag = 'ca' and name = 'Tokelau';
select 1 / count(*) from country_i18n where country_code = 'TK' and lang_tag = 'es' and name = 'Tokelau';
select 1 / count(*) from country_i18n where country_code = 'TL' and lang_tag = 'ca' and name = 'Timor Oriental';
select 1 / count(*) from country_i18n where country_code = 'TL' and lang_tag = 'es' and name = 'Timor Oriental';
select 1 / count(*) from country_i18n where country_code = 'TM' and lang_tag = 'ca' and name = 'Turkmenistan';
select 1 / count(*) from country_i18n where country_code = 'TM' and lang_tag = 'es' and name = 'Turkmenistán';
select 1 / count(*) from country_i18n where country_code = 'TN' and lang_tag = 'ca' and name = 'Tunísia';
select 1 / count(*) from country_i18n where country_code = 'TN' and lang_tag = 'es' and name = 'Túnez';
select 1 / count(*) from country_i18n where country_code = 'TO' and lang_tag = 'ca' and name = 'Tonga';
select 1 / count(*) from country_i18n where country_code = 'TO' and lang_tag = 'es' and name = 'Tonga';
select 1 / count(*) from country_i18n where country_code = 'TR' and lang_tag = 'ca' and name = 'Turquia';
select 1 / count(*) from country_i18n where country_code = 'TR' and lang_tag = 'es' and name = 'Turquía';
select 1 / count(*) from country_i18n where country_code = 'TT' and lang_tag = 'ca' and name = 'Trinitat i Tobago';
select 1 / count(*) from country_i18n where country_code = 'TT' and lang_tag = 'es' and name = 'Trinidad y Tobago';
select 1 / count(*) from country_i18n where country_code = 'TV' and lang_tag = 'ca' and name = 'Tuvalu';
select 1 / count(*) from country_i18n where country_code = 'TV' and lang_tag = 'es' and name = 'Tuvalu';
select 1 / count(*) from country_i18n where country_code = 'TW' and lang_tag = 'ca' and name = 'Taiwan';
select 1 / count(*) from country_i18n where country_code = 'TW' and lang_tag = 'es' and name = 'Taiwán';
select 1 / count(*) from country_i18n where country_code = 'TZ' and lang_tag = 'ca' and name = 'Tanzània';
select 1 / count(*) from country_i18n where country_code = 'TZ' and lang_tag = 'es' and name = 'Tanzania';
select 1 / count(*) from country_i18n where country_code = 'UA' and lang_tag = 'ca' and name = 'Ucraïna';
select 1 / count(*) from country_i18n where country_code = 'UA' and lang_tag = 'es' and name = 'Ucrania';
select 1 / count(*) from country_i18n where country_code = 'UG' and lang_tag = 'ca' and name = 'Uganda';
select 1 / count(*) from country_i18n where country_code = 'UG' and lang_tag = 'es' and name = 'Uganda';
select 1 / count(*) from country_i18n where country_code = 'UM' and lang_tag = 'ca' and name = 'Illes dUltramar Menors dels Estats Units';
select 1 / count(*) from country_i18n where country_code = 'UM' and lang_tag = 'es' and name = 'Islas de ultramar menores de Estados Unidos (EEUU)';
select 1 / count(*) from country_i18n where country_code = 'US' and lang_tag = 'ca' and name = 'Estats Units (US)';
select 1 / count(*) from country_i18n where country_code = 'US' and lang_tag = 'es' and name = 'Estados Unidos (EEUU)';
select 1 / count(*) from country_i18n where country_code = 'UY' and lang_tag = 'ca' and name = 'Uruguai';
select 1 / count(*) from country_i18n where country_code = 'UY' and lang_tag = 'es' and name = 'Uruguay';
select 1 / count(*) from country_i18n where country_code = 'UZ' and lang_tag = 'ca' and name = 'Uzbekistan';
select 1 / count(*) from country_i18n where country_code = 'UZ' and lang_tag = 'es' and name = 'Uzbekistán';
select 1 / count(*) from country_i18n where country_code = 'VA' and lang_tag = 'ca' and name = 'Vaticà';
select 1 / count(*) from country_i18n where country_code = 'VA' and lang_tag = 'es' and name = 'Ciudad del Vaticano';
select 1 / count(*) from country_i18n where country_code = 'VC' and lang_tag = 'ca' and name = 'Saint Vincent i les Grenadines';
select 1 / count(*) from country_i18n where country_code = 'VC' and lang_tag = 'es' and name = 'San Vicente y las Granadinas';
select 1 / count(*) from country_i18n where country_code = 'VE' and lang_tag = 'ca' and name = 'Veneçuela';
select 1 / count(*) from country_i18n where country_code = 'VE' and lang_tag = 'es' and name = 'Venezuela';
select 1 / count(*) from country_i18n where country_code = 'VG' and lang_tag = 'ca' and name = 'Illes Verges (Britàniques)';
select 1 / count(*) from country_i18n where country_code = 'VG' and lang_tag = 'es' and name = 'Islas Vírgenes (Británicas)';
select 1 / count(*) from country_i18n where country_code = 'VI' and lang_tag = 'ca' and name = 'Illes Verges (EUA)';
select 1 / count(*) from country_i18n where country_code = 'VI' and lang_tag = 'es' and name = 'Islas Vírgenes (EEUU)';
select 1 / count(*) from country_i18n where country_code = 'VN' and lang_tag = 'ca' and name = 'Vietnam';
select 1 / count(*) from country_i18n where country_code = 'VN' and lang_tag = 'es' and name = 'Vietnam';
select 1 / count(*) from country_i18n where country_code = 'VU' and lang_tag = 'ca' and name = 'Vanuatu';
select 1 / count(*) from country_i18n where country_code = 'VU' and lang_tag = 'es' and name = 'Vanuatu';
select 1 / count(*) from country_i18n where country_code = 'WF' and lang_tag = 'ca' and name = 'Wallis i Futuna';
select 1 / count(*) from country_i18n where country_code = 'WF' and lang_tag = 'es' and name = 'Wallis y Futuna';
select 1 / count(*) from country_i18n where country_code = 'WS' and lang_tag = 'ca' and name = 'Samoa';
select 1 / count(*) from country_i18n where country_code = 'WS' and lang_tag = 'es' and name = 'Samoa';
select 1 / count(*) from country_i18n where country_code = 'YE' and lang_tag = 'ca' and name = 'Iemen';
select 1 / count(*) from country_i18n where country_code = 'YE' and lang_tag = 'es' and name = 'Yemen';
select 1 / count(*) from country_i18n where country_code = 'YT' and lang_tag = 'ca' and name = 'Mayotte';
select 1 / count(*) from country_i18n where country_code = 'YT' and lang_tag = 'es' and name = 'Mayotte';
select 1 / count(*) from country_i18n where country_code = 'ZA' and lang_tag = 'ca' and name = 'Sud-àfrica';
select 1 / count(*) from country_i18n where country_code = 'ZA' and lang_tag = 'es' and name = 'Sudáfrica';
select 1 / count(*) from country_i18n where country_code = 'ZM' and lang_tag = 'ca' and name = 'Zàmbia';
select 1 / count(*) from country_i18n where country_code = 'ZM' and lang_tag = 'es' and name = 'Zambia';
select 1 / count(*) from country_i18n where country_code = 'ZW' and lang_tag = 'ca' and name = 'Zimbàbue';
select 1 / count(*) from country_i18n where country_code = 'ZW' and lang_tag = 'es' and name = 'Zimbabue';
rollback;

View File

@ -14,7 +14,7 @@ select company_id
, city
, province
, postal_code
, country_code
, country
, currency_code
, created_at
from numerus.company

View File

@ -1,11 +0,0 @@
-- Verify numerus:country on pg
begin;
select country_code
, name
, postal_code_regex
from numerus.country
where false;
rollback;

View File

@ -1,7 +0,0 @@
-- Verify numerus:country_code on pg
begin;
select pg_catalog.has_type_privilege('numerus.country_code', 'usage');
rollback;

View File

@ -1,11 +0,0 @@
-- Verify numerus:country_i18n on pg
begin;
select country_code
, lang_tag
, name
from numerus.country_i18n
where false;
rollback;

View File

@ -42,16 +42,10 @@
<input type="text" name="postal_code" id="postal_code" required="required" value="{{ .PostalCode }}" placeholder="{{( pgettext "Postal code" "input" )}}">
<label for="postal_code">{{( pgettext "Postal code" "input" )}}</label>
</div>
<div class="input">
<select id="country" name="country">
{{- range $country := .Countries }}
<option value="{{ .Code }}" {{ if eq .Code $.CountryCode }}selected="selected"{{ end }}>{{ .Name }}</option>
{{- end }}
</select>
<label for="country">{{( pgettext "Country" "input" )}}<label>
<input type="text" name="country" id="country" required="required" value="{{ .Country }}" placeholder="{{( pgettext "Country" "input" )}}">
<label for="country">{{( pgettext "Country" "input" )}}</label>
</div>
<button type="submit">{{( pgettext "Save changes" "action" )}}</button>
</form>
</section>