Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translations for country names. #1

Open
chronossc opened this issue Feb 19, 2012 · 18 comments
Open

Translations for country names. #1

chronossc opened this issue Feb 19, 2012 · 18 comments
Assignees
Labels

Comments

@chronossc
Copy link

Hello :], this is a idea and not a real issue.

What about allow country name translations?
We can have a table like:

class Country(models.Model):
    ...
    def get_translation(self,language):
        try:
            return self.translations.get(country=self.iso3,language=language).name
        except (ObjectDoesNotExist,AttributeError):
            return self.name
class CountryTranslations(models.Model):
    country = models.ForeignKey(Country,to_field='iso3',related_name='translations')
    language = models.CharField(max_length=15)
    name = models.CharField(max_length=32)

We have a list of possible language codes in locale module (or we can search on other places).

Also, we can put it in gettext files in some way, so we can keep it versioned and without need of fixtures.

What u think about?

@naftulikay
Copy link
Owner

  1. I'd be happy to collaborate on doing something to facilitate making translations possible. That would be awesome.
  2. The whole point of the library is to provide fixtures. I do think, however, that you can write fixtures in plain Python, so we could have a Python fixture which would load a gettext file and populate the database with those values. That would make sense.

Feel free, if not compelled, to fork the project and create a CountryNameTranslation object ;)

@chronossc
Copy link
Author

I can do it, but I'm not focused on app right now. just see it in django
list of pypi and find it very important.

When I touch your app again I'll think about whole thing.

Translations on DB is most obvious but not sounds good when many people
will send translations to us.

A message file in this case sounds much better.

I guess that best shot is a translation file and cache for translations.

One simple translation method can push translations to a memcached ...
something like that.

Cheers

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc

2012/2/19 rfkrocktk <
reply@reply.github.com

  1. I'd be happy to collaborate on doing something to facilitate making
    translations possible. That would be awesome.
  2. The whole point of the library is to provide fixtures. I do think,
    however, that you can write fixtures in plain Python, so we could have a
    Python fixture which would load a gettext file and populate the database
    with those values. That would make sense.

Feel free, if not compelled, to fork the project and create a
CountryNameTranslation object ;)


Reply to this email directly or view it on GitHub:
#1 (comment)

@ghost ghost assigned naftulikay Mar 7, 2012
@Lacrymology
Copy link
Contributor

I've created a management command that receives a locale and creates a messages file for it with all the objects from the database, and added a translated_name property to both models which returns ugettext_lazy(self.name). It should be an OK starting point to start collecting translations for the app

@naftulikay
Copy link
Owner

Cool, thanks so much. You want to take everything out of the database, though? Part of the whole theory of the project is to keep everything in the database if possible so that other objects can actually own country and territory objects, ie:

create table user_location (id int primary key auto increment, country_id int, territory_id int null, ...);

This gives a lot greater flexibility than simply embedding things in messages files. Plus, if you implement memcached and a query cache, you could presumably just cache the entire locality_country and locality_territory tables locally in memory, thus always avoiding the hit to the DB.

Why implement things in messages files when you get more functionality and (with the right configuration) equal or better performance when in the database?

@Lacrymology I'm totally for what you're suggesting, but I dunno, I just like having things in the database. Call me crazy, but it just seems so much cooler that way.

Perhaps a bigger scope is in order. It might be wise to just create a Language table and allow associating a Language with any given number of Country objects within which its primarily spoken. We could then associate CountryNameTranslation with a Language and with a Country.

@Lacrymology
Copy link
Contributor

I don't think filling the database with tons of strings sounds like a good idea. I don't like having two different objects that represent the same thing. Of course, both approaches work, but I don't see what's the gain in having the translations in the database.

@Lacrymology
Copy link
Contributor

Oh, and I don't want to take anything out of the database. But I wouldn't put translations in, that's it.

The thing with translations is that sharing fixtures around is a real pain

@naftulikay
Copy link
Owner

Now that you mention it, it might be wise to just keep the translations local. They can be tied to each country by its id.

The only thing I think we're really losing is interoperability with other applications; if the translations are stored in the database, then other applications can access them as well. (eg: if you have Django for your web front and Java as an asynchronous task runner which pulls things from the database, it would have to pull in the message files to get translations for country names.)

@chronossc
Copy link
Author

My 2 cents o talk:

Keep in database is really good for interoperability, but maintain fixtures
is annoing. It's absolutely impraticable a team colaborate with fixtures if
you don't offer a common way to add countries (a site to it?).

At other side, .mo files is just files and can be easily merged by team
members or contributors. Also, .mo files can be read and have data imported
to database with some effort (if Python don't have a tool to do it), and to
cache.

Cheers,

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc

2012/3/12 rfkrocktk <
reply@reply.github.com

Now that you mention it, it might be wise to just keep the translations
local. They can be tied to each country by its id.

The only thing I think we're really losing is interoperability with other
applications; if the translations are stored in the database, then other
applications can access them as well. (eg: if you have Django for your web
front and Java as an asynchronous task runner which pulls things from the
database, it would have to pull in the message files to get translations.)


Reply to this email directly or view it on GitHub:
#1 (comment)

@naftulikay
Copy link
Owner

Since we're doing everything in fixtures anyway, your argument isn't valid: simply examine the src/locality/fixtures/initial_data.json file. It's in version control and can be collaborated on by multiple people.

An alternative approach would be to essentially merge the two ideas; provide translation files, but as a fixture, import them and send them to the database when syncdb is called. In my opinion, that wins on all fronts. Get translations from the database if you want them or get them locally if that's better for you.

@Lacrymology
Copy link
Contributor

@rfkrocktk have you actually tried working on fixtures with two or three people? I do it to develop django-cms based sites, and it's REALLY a pain. True, it is rather bigger than this, but still..

I still don't see how would some javascript talk straight to the database. You'll be calling on a view, which can do whatever it wants with the country/territory names before returning them. For example

def get_territories_list(request, country_id, lang='en'):
    country = get_object_or_404(Country, pk=country_id)
    ret = []
    translation.activate(lang)
    for ter in country.territories.all():
        ret.append({
            'code': ter.abbr,
            'lang': ter.translated_name,
            })
   return json.encode(ret)

(I just realized I might have used the _lazy flavour of ugettext which wouldn't work in this case)

@naftulikay
Copy link
Owner

@Lacrymology, it wouldn't be JavaScript, it'd be Python. Essentially, I'd listen for the post_syncdb signal and then run some Python which reads the message files and inserts them into the database if they're not already present. Essentially, it'd allow our message files to act like fixtures.

@chronossc
Copy link
Author

Sirs, polib can read .po files so we can import it to database very easily, so we easily maintain .po files with country translations, and with one management command, can import it to database. See:

In [1]: import polib

In [2]: po = polib.pofile('/home/felipe/projects/p3/src/django/django/conf/locale/pt_BR/LC_MESSAGES/django.po')

In [3]: po.translated_entries()[0].__dict__
Out[3]: 
{'comment': '',
 'encoding': 'utf-8',
 'flags': [],
 'msgctxt': None,
 'msgid': u'Arabic',
 'msgid_plural': '',
 'msgstr': u'\xc1rabe',
 'msgstr_plural': {},
 'obsolete': 0,
 'occurrences': [(u'conf/global_settings.py', u'44')],
 'previous_msgctxt': None,
 'previous_msgid': None,
 'previous_msgid_plural': None,
 'tcomment': ''}

@naftulikay
Copy link
Owner

Nice. I haven't worked with polib before, but that looks pretty cool.

@Lacrymology
Copy link
Contributor

@rfkrocktk oh, you said Java, not javascript. My bad

@naftulikay
Copy link
Owner

@Lacrymology yeah, just talking about some other generic service (could by anything, PHP, Java, whatever) using the same database as Django. It happens.

@chronossc
Copy link
Author

Good, so we can create a .PO file with all country names in locale/en/LC_MESSAGES/django.po and use this one as template to other languages.

We (and I'm on that task) can work on the reader using polib and import it to the model CountryTranslations I mentioned on firtst post, but following scope sugested by @rfkrocktk .

In templates, and in any place that don't need a hit in DB for get translation, will be used ugettext (or the lazy version). For interoperability with other applications database with translations can be read.

More some idea on that? Considerations?

@chronossc
Copy link
Author

Just to log, I get from pycountry project a full list of locales. Guys can found at http://devwithpassion.com/locale_codes.txt

@chronossc
Copy link
Author

Finishing works for today, I have hacked around pycountry a bit and defined models for translations.
Also added locale codes from pycountry (list at http://devwithpassion.com/locale_codes.txt) to Language model.

In my hacking I see that pycountry (http://pypi.python.org/pypi/pycountry) have most translations that we want, so we only need to work with pycountry to load translations into database, providing the 'interoperability'. There is one package, the djangool (https://github.com/cilcoberlin/djangoool) that provide models to use in database for data existent in pycountry. We can do same.

I guess that the best about translations is use the ones provided by pycountry, but I don't know (and will look only tomorrow) if django have support to external .mo files in templates, etc.

Here is how I imported translations for pt_BR.

In [1]: from locality.models import *

In [2]: import polib

In [3]: po = polib.pofile('/home/felipe/projects/github_projects_2/lib/python2.7/site-packages/pycountry-0.14.1-py2.7.egg/pycountry/locales/pt_BR/LC_MESSAGES/iso3166.po')

In [4]: l = Language.objects.get(locale=po.metadata.get('Language'))

In [5]: for e in po.translated_entries():
    try:
        c = Country.objects.get(name=e.msgid)
        print CountryNameTranslation.objects.create(country=c,language=l,translated=e.msgstr)
    except Country.DoesNotExist:
        print "ERR","Country '%s' not found on locality db" % e.msgid
    except Exception,err:
        print "ERR",e.msgid,err
   ...:         
ERR Country 'Afghanistan' not found on locality db
ERR Country 'Islamic Republic of Afghanistan' not found on locality db
ERR Country 'Åland Islands' not found on locality db
ERR Country 'Albania' not found on locality db
ERR Country 'Republic of Albania' not found on locality db
Argélia
ERR Country 'People's Democratic Republic of Algeria' not found on locality db
Samoa Americana
Andorra
ERR Country 'Principality of Andorra' not found on locality db
Angola
ERR Country 'Republic of Angola' not found on locality db
Anguila
Antártida
Antígua e Barbuda
Argentina
ERR Country 'Argentine Republic' not found on locality db
Armênia
ERR Country 'Republic of Armenia' not found on locality db
Aruba
Austrália
Áustria
ERR Country 'Republic of Austria' not found on locality db
Azerbaidjão
ERR Country 'Republic of Azerbaijan' not found on locality db
Bahamas
ERR Country 'Commonwealth of the Bahamas' not found on locality db
Barein
ERR Country 'Kingdom of Bahrain' not found on locality db
Bangladesh
ERR Country 'People's Republic of Bangladesh' not found on locality db
Barbados
Bielo-Rússia
ERR Country 'Republic of Belarus' not found on locality db
Bélgica
ERR Country 'Kingdom of Belgium' not found on locality db
ERR Country 'Belize' not found on locality db
Benin
ERR Country 'Republic of Benin' not found on locality db
Bermuda
Butão
ERR Country 'Kingdom of Bhutan' not found on locality db
ERR Country 'Bolivia, Plurinational State of' not found on locality db
ERR Country 'Plurinational State of Bolivia' not found on locality db
Bolívia
Bósnia-Herzegóvina
ERR Country 'Republic of Bosnia and Herzegovina' not found on locality db
Botsuana
ERR Country 'Republic of Botswana' not found on locality db
Ilha Bouvet
Brasil
ERR Country 'Federative Republic of Brazil' not found on locality db
ERR Country 'British Indian Ocean Territory' not found on locality db
ERR Country 'Brunei Darussalam' not found on locality db
Bulgária
ERR Country 'Republic of Bulgaria' not found on locality db
Burquina
Burundi
ERR Country 'Republic of Burundi' not found on locality db
Camboja
ERR Country 'Kingdom of Cambodia' not found on locality db
Camarões
ERR Country 'Republic of Cameroon' not found on locality db
Canadá
Cabo Verde
ERR Country 'Republic of Cape Verde' not found on locality db
Ilhas Cayman
República Centro-Africana
Chade
ERR Country 'Republic of Chad' not found on locality db
Chile
ERR Country 'Republic of Chile' not found on locality db
China
ERR Country 'People's Republic of China' not found on locality db
Ilha Christmas
Ilhas Cocos
Colômbia
ERR Country 'Republic of Colombia' not found on locality db
Comores
ERR Country 'Union of the Comoros' not found on locality db
ERR Country 'Congo' not found on locality db
ERR Country 'Republic of the Congo' not found on locality db
ERR Country 'Congo, The Democratic Republic of the' not found on locality db
Ilhas Cook
Costa Rica
ERR Country 'Republic of Costa Rica' not found on locality db
Costa do Marfim
ERR Country 'Republic of Côte d'Ivoire' not found on locality db
Croácia
ERR Country 'Republic of Croatia' not found on locality db
Cuba
ERR Country 'Republic of Cuba' not found on locality db
Chipre
ERR Country 'Republic of Cyprus' not found on locality db
República Tcheca
Dinamarca
ERR Country 'Kingdom of Denmark' not found on locality db
Djibuti
ERR Country 'Republic of Djibouti' not found on locality db
Domínica
ERR Country 'Commonwealth of Dominica' not found on locality db
República Dominicana
Equador
ERR Country 'Republic of Ecuador' not found on locality db
Egito
ERR Country 'Arab Republic of Egypt' not found on locality db
El Salvador
ERR Country 'Republic of El Salvador' not found on locality db
Guiné Equatorial
ERR Country 'Republic of Equatorial Guinea' not found on locality db
Eritréia
Estônia
ERR Country 'Republic of Estonia' not found on locality db
Etiópia
ERR Country 'Federal Democratic Republic of Ethiopia' not found on locality db
ERR Country 'Falkland Islands (Malvinas)' not found on locality db
Ilhas Faroe
Fiji
ERR Country 'Republic of the Fiji Islands' not found on locality db
Finlândia
ERR Country 'Republic of Finland' not found on locality db
França
ERR Country 'French Republic' not found on locality db
Guiana Francesa
Polinésia Francesa
ERR Country 'French Southern Territories' not found on locality db
Gabão
ERR Country 'Gabonese Republic' not found on locality db
Gâmbia
ERR Country 'Republic of the Gambia' not found on locality db
Geórgia
Alemanha
ERR Country 'Federal Republic of Germany' not found on locality db
Gana
ERR Country 'Republic of Ghana' not found on locality db
Gibraltar
Grécia
ERR Country 'Hellenic Republic' not found on locality db
Groenlândia
Granada
Guadalupe
Guam
Guatemala
ERR Country 'Republic of Guatemala' not found on locality db
Guernsey
Guiné
ERR Country 'Republic of Guinea' not found on locality db
Guiné-Bissau
ERR Country 'Republic of Guinea-Bissau' not found on locality db
Guiana
ERR Country 'Republic of Guyana' not found on locality db
Haiti
ERR Country 'Republic of Haiti' not found on locality db
ERR Country 'Heard Island and McDonald Islands' not found on locality db
ERR Country 'Holy See (Vatican City State)' not found on locality db
Honduras
ERR Country 'Republic of Honduras' not found on locality db
Hong Kong
ERR Country 'Hong Kong Special Administrative Region of China' not found on locality db
Hungria
ERR Country 'Republic of Hungary' not found on locality db
Islândia
ERR Country 'Republic of Iceland' not found on locality db
Índia
ERR Country 'Republic of India' not found on locality db
Indonésia
ERR Country 'Republic of Indonesia' not found on locality db
ERR Country 'Iran, Islamic Republic of' not found on locality db
ERR Country 'Islamic Republic of Iran' not found on locality db
Iraque
ERR Country 'Republic of Iraq' not found on locality db
Irlanda
Ilha de Man
Israel
ERR Country 'State of Israel' not found on locality db
Itália
ERR Country 'Italian Republic' not found on locality db
Jamaica
Japão
Jersey
Jordânia
ERR Country 'Hashemite Kingdom of Jordan' not found on locality db
Cazaquistão
ERR Country 'Republic of Kazakhstan' not found on locality db
Quênia
ERR Country 'Republic of Kenya' not found on locality db
Kiribati
ERR Country 'Republic of Kiribati' not found on locality db
ERR Country 'Korea, Democratic People's Republic of' not found on locality db
ERR Country 'Democratic People's Republic of Korea' not found on locality db
ERR Country 'Korea, Republic of' not found on locality db
Kuwait
ERR Country 'State of Kuwait' not found on locality db
Quirguistão
ERR Country 'Kyrgyz Republic' not found on locality db
ERR Country 'Lao People's Democratic Republic' not found on locality db
Letônia
ERR Country 'Republic of Latvia' not found on locality db
Líbano
ERR Country 'Lebanese Republic' not found on locality db
Lesoto
ERR Country 'Kingdom of Lesotho' not found on locality db
Libéria
ERR Country 'Republic of Liberia' not found on locality db
ERR Country 'Libyan Arab Jamahiriya' not found on locality db
ERR Country 'Socialist People's Libyan Arab Jamahiriya' not found on locality db
Líbia
Liechtenstein
ERR Country 'Principality of Liechtenstein' not found on locality db
Lituânia
ERR Country 'Republic of Lithuania' not found on locality db
Luxemburgo
ERR Country 'Grand Duchy of Luxembourg' not found on locality db
ERR Country 'Macao' not found on locality db
ERR Country 'Macao Special Administrative Region of China' not found on locality db
ERR Country 'Macedonia, Republic of' not found on locality db
ERR Country 'The Former Yugoslav Republic of Macedonia' not found on locality db
Madagascar
ERR Country 'Republic of Madagascar' not found on locality db
Malaui
ERR Country 'Republic of Malawi' not found on locality db
Malásia
Maldivas
ERR Country 'Republic of Maldives' not found on locality db
Mali
ERR Country 'Republic of Mali' not found on locality db
Malta
ERR Country 'Republic of Malta' not found on locality db
Ilhas Marshall
ERR Country 'Republic of the Marshall Islands' not found on locality db
Martinica
Mauritânia
ERR Country 'Islamic Republic of Mauritania' not found on locality db
Maurício
ERR Country 'Republic of Mauritius' not found on locality db
Maiote
México
ERR Country 'United Mexican States' not found on locality db
ERR Country 'Micronesia, Federated States of' not found on locality db
ERR Country 'Federated States of Micronesia' not found on locality db
ERR Country 'Moldova, Republic of' not found on locality db
ERR Country 'Republic of Moldova' not found on locality db
Moldávia
Mônaco
ERR Country 'Principality of Monaco' not found on locality db
Mongólia
Montenegro
Montserrat
Marrocos
ERR Country 'Kingdom of Morocco' not found on locality db
Moçambique
ERR Country 'Republic of Mozambique' not found on locality db
Myanmar
ERR Country 'Union of Myanmar' not found on locality db
Namíbia
ERR Country 'Republic of Namibia' not found on locality db
Nauru
ERR Country 'Republic of Nauru' not found on locality db
Nepal
ERR Country 'Federal Democratic Republic of Nepal' not found on locality db
Países Baixos
ERR Country 'Kingdom of the Netherlands' not found on locality db
Nova Caledônia
Nova Zelândia
Nicarágua
ERR Country 'Republic of Nicaragua' not found on locality db
Níger
ERR Country 'Republic of the Niger' not found on locality db
Nigéria
ERR Country 'Federal Republic of Nigeria' not found on locality db
Niue
ERR Country 'Republic of Niue' not found on locality db
Ilha Norfolk
Ilhas Marianas do Norte
ERR Country 'Commonwealth of the Northern Mariana Islands' not found on locality db
Noruega
ERR Country 'Kingdom of Norway' not found on locality db
Omã
ERR Country 'Sultanate of Oman' not found on locality db
Paquistão
ERR Country 'Islamic Republic of Pakistan' not found on locality db
Palau
ERR Country 'Republic of Palau' not found on locality db
ERR Country 'Palestinian Territory, Occupied' not found on locality db
ERR Country 'Occupied Palestinian Territory' not found on locality db
Panamá
ERR Country 'Republic of Panama' not found on locality db
Papua Nova Guiné
Paraguai
ERR Country 'Republic of Paraguay' not found on locality db
Peru
ERR Country 'Republic of Peru' not found on locality db
Filipinas
ERR Country 'Republic of the Philippines' not found on locality db
Pitcairn
Polônia
ERR Country 'Republic of Poland' not found on locality db
Portugal
ERR Country 'Portuguese Republic' not found on locality db
Porto Rico
Catar
ERR Country 'State of Qatar' not found on locality db
Reunião
Romênia
Federação Russa
Ruanda
ERR Country 'Rwandese Republic' not found on locality db
Saint Barthélemy
São Cristóvão e Névis
Santa Lúcia
São Martim (parte francesa)
São Pedro e Miquelon
ERR Country 'Saint Vincent and the Grenadines' not found on locality db
Samoa
ERR Country 'Independent State of Samoa' not found on locality db
São Marino
ERR Country 'Republic of San Marino' not found on locality db
São Tomé e Príncipe
ERR Country 'Democratic Republic of Sao Tome and Principe' not found on locality db
Arábia Saudita
ERR Country 'Kingdom of Saudi Arabia' not found on locality db
Senegal
ERR Country 'Republic of Senegal' not found on locality db
Sérvia
ERR Country 'Republic of Serbia' not found on locality db
Seychelles
ERR Country 'Republic of Seychelles' not found on locality db
Serra Leoa
ERR Country 'Republic of Sierra Leone' not found on locality db
Cingapura
ERR Country 'Republic of Singapore' not found on locality db
Eslováquia
ERR Country 'Slovak Republic' not found on locality db
Eslovênia
ERR Country 'Republic of Slovenia' not found on locality db
ERR Country 'Solomon Islands' not found on locality db
Somália
ERR Country 'Somali Republic' not found on locality db
África do Sul
ERR Country 'Republic of South Africa' not found on locality db
ERR Country 'South Georgia and the South Sandwich Islands' not found on locality db
Espanha
ERR Country 'Kingdom of Spain' not found on locality db
Sri Lanka
ERR Country 'Democratic Socialist Republic of Sri Lanka' not found on locality db
Sudão
ERR Country 'Republic of the Sudan' not found on locality db
Suriname
ERR Country 'Republic of Suriname' not found on locality db
ERR Country 'Svalbard and Jan Mayen' not found on locality db
Suazilândia
ERR Country 'Kingdom of Swaziland' not found on locality db
Suécia
ERR Country 'Kingdom of Sweden' not found on locality db
Suíça
ERR Country 'Swiss Confederation' not found on locality db
ERR Country 'Syrian Arab Republic' not found on locality db
ERR Country 'Taiwan, Province of China' not found on locality db
Taiwan
Tadjiquistão
ERR Country 'Republic of Tajikistan' not found on locality db
ERR Country 'Tanzania, United Republic of' not found on locality db
ERR Country 'United Republic of Tanzania' not found on locality db
Tailândia
ERR Country 'Kingdom of Thailand' not found on locality db
Timor Leste
ERR Country 'Democratic Republic of Timor-Leste' not found on locality db
Togo
ERR Country 'Togolese Republic' not found on locality db
Toquelau
Tonga
ERR Country 'Kingdom of Tonga' not found on locality db
Trinidade e Tobago
ERR Country 'Republic of Trinidad and Tobago' not found on locality db
Tunísia
ERR Country 'Republic of Tunisia' not found on locality db
Turquia
ERR Country 'Republic of Turkey' not found on locality db
Turcomenistão
Ilhas Turks e Caicos
Tuvalu
Uganda
ERR Country 'Republic of Uganda' not found on locality db
Ucrânia
Emirados Árabes Unidos
Reino Unido
ERR Country 'United Kingdom of Great Britain and Northern Ireland' not found on locality db
ERR Country 'United States' not found on locality db
Estados Unidos da América
ERR Country 'United States Minor Outlying Islands' not found on locality db
Uruguai
ERR Country 'Eastern Republic of Uruguay' not found on locality db
Uzbequistão
ERR Country 'Republic of Uzbekistan' not found on locality db
Vanuatu
ERR Country 'Republic of Vanuatu' not found on locality db
ERR Country 'Venezuela, Bolivarian republic of' not found on locality db
ERR Country 'Bolivarian Republic of Venezuela' not found on locality db
Venezuela
ERR Country 'Viet Nam' not found on locality db
ERR Country 'Socialist Republic of Viet Nam' not found on locality db
Ilhas Virgens Britânicas
ERR Country 'British Virgin Islands' not found on locality db
Ilhas Virgens dos Estados Unidos
ERR Country 'Virgin Islands of the United States' not found on locality db
ERR Country 'Wallis and Futuna' not found on locality db
Saara Ocidental
Iêmen
ERR Country 'Republic of Yemen' not found on locality db
Zâmbia
ERR Country 'Republic of Zambia' not found on locality db
Zimbábue
ERR Country 'Republic of Zimbabwe' not found on locality db
ERR Country 'British Antarctic Territory' not found on locality db
ERR Country 'Burma, Socialist Republic of the Union of' not found on locality db
ERR Country 'Byelorussian SSR Soviet Socialist Republic' not found on locality db
ERR Country 'Canton and Enderbury Islands' not found on locality db
ERR Country 'Czechoslovakia, Czechoslovak Socialist Republic' not found on locality db
ERR Country 'Dahomey' not found on locality db
ERR Country 'Dronning Maud Land' not found on locality db
ERR Country 'East Timor' not found on locality db
ERR Country 'France, Metropolitan' not found on locality db
ERR Country 'French Afars and Issas' not found on locality db
ERR Country 'French Southern and Antarctic Territories' not found on locality db
ERR Country 'German Democratic Republic' not found on locality db
ERR Country 'Germany, Federal Republic of' not found on locality db
ERR Country 'Gilbert and Ellice Islands' not found on locality db
ERR Country 'Johnston Island' not found on locality db
ERR Country 'Midway Islands' not found on locality db
ERR Country 'Netherlands Antilles' not found on locality db
ERR Country 'Neutral Zone' not found on locality db
ERR Country 'New Hebrides' not found on locality db
ERR Country 'Pacific Islands (trust territory)' not found on locality db
ERR Country 'Panama, Republic of' not found on locality db
ERR Country 'Panama Canal Zone' not found on locality db
ERR Country 'Romania, Socialist Republic of' not found on locality db
ERR Country 'St. Kitts-Nevis-Anguilla' not found on locality db
ERR Country 'Serbia and Montenegro' not found on locality db
ERR Country 'Sikkim' not found on locality db
ERR Country 'Southern Rhodesia' not found on locality db
ERR Country 'Spanish Sahara' not found on locality db
ERR Country 'US Miscellaneous Pacific Islands' not found on locality db
ERR Country 'USSR, Union of Soviet Socialist Republics' not found on locality db
ERR Country 'Upper Volta, Republic of' not found on locality db
ERR Country 'Vatican City State (Holy See)' not found on locality db
ERR Country 'Viet-Nam, Democratic Republic of' not found on locality db
ERR Country 'Wake Island' not found on locality db
ERR Country 'Yemen, Democratic, People's Democratic Republic of' not found on locality db
ERR Country 'Yemen, Yemen Arab Republic' not found on locality db
ERR Country 'Yugoslavia, Socialist Federal Republic of' not found on locality db
ERR Country 'Zaire, Republic of' not found on locality db

In [6]: from random import choice

In [7]: c = choice(Country.objects.all())

In [8]: c
Out[8]: <Country: Cuba>

In [9]: c.get_translation('pt_BR')
Out[9]: <CountryNameTranslation: Cuba>

In [10]: c = choice(Country.objects.all())

In [11]: c
Out[11]: <Country: France>

In [12]: c.get_translation('pt_BR')
Out[12]: <CountryNameTranslation: França>

In [13]: c = choice(Country.objects.all())

In [14]: c
Out[14]: <Country: French Guiana>

In [15]: c.get_translation('pt_BR')
Out[15]: <CountryNameTranslation: Guiana Francesa>

The code is at https://github.com/chronossc/django-locality/tree/chronossc and this branch have @Lacrymology changes merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@chronossc @naftulikay @Lacrymology and others