coto / gae-boilerplate

Google App Engine Boilerplate
https://dev-dot-sandengine.appspot.com/
Other
684 stars 187 forks source link

Use Babel territories for List of Countries #162

Open coto opened 12 years ago

coto commented 12 years ago

In order to show the countries in any language sopported, we have to use Babel to show the countries with:

from babel import Locale COUNTRIES = Locale('es').territories

here: https://github.com/coto/gae-boilerplate/blob/master/boilerplate/lib/utils.py#L207

We can't use it directly, because it throws the following error:

TypeError: 'NoneType' object is not callable

peta15 commented 12 years ago

this page shows how it is intended to be used: http://babel.edgewall.org/wiki/Documentation/0.9/display.html We need the locale object set in the basehandler which determines which language we are using the render the site and then you can call the territories dict from that. The hard part is getting the locale object set in the basehandler.

coto commented 12 years ago

good point, i'll check it out

On Mon, Oct 8, 2012 at 5:07 PM, Jesse Goodall notifications@github.comwrote:

this page shows how it is intended to be used: http://babel.edgewall.org/wiki/Documentation/0.9/display.html We need the locale object set in the basehandler which determines which language we are using the render the site and then you can call the territories dict from that. The hard part is getting the locale object set in the basehandler.

— Reply to this email directly or view it on GitHubhttps://github.com/coto/gae-boilerplate/issues/162#issuecomment-9238418.

peta15 commented 12 years ago

two more ideas:

  1. country can be auto-detected using our lib/i18n.py (it is usually done already to determine language).
  2. if we can't figure out how to get this to work with both babel and wtforms we can either remove it from wtforms or we can remove the countries drop down altogether since it is only a registration demo (or are you actually using it on a project?)
coto commented 12 years ago

I am using it on a project, but the reason it has country for registration (some time ago I read a research) is because after email, password, username, name and last name, the next most important field for international sites, is Country.

Back2Basics commented 12 years ago

I'm using it on a project as well. Do you want to verify IP address -> country mapping or just take the persons word?