Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/alexandersimoes/oec
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Mar 12, 2014
2 parents ae0ec81 + 454a502 commit e7e3d60
Show file tree
Hide file tree
Showing 34 changed files with 1,236 additions and 769 deletions.
97 changes: 59 additions & 38 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2014-03-03 17:53-0500\n"
"POT-Creation-Date: 2014-03-11 18:36-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -17,60 +17,60 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"

#: oec/explore/models.py:283
#: oec/explore/models.py:356
msgid "Origin Country"
msgstr ""

#: oec/explore/models.py:284 oec/explore/models.py:287
#: oec/html/explore/embed.html:300
#: oec/explore/models.py:357 oec/explore/models.py:360
#: oec/html/explore/embed.html:333
msgid "ID"
msgstr ""

#: oec/explore/models.py:286
#: oec/explore/models.py:359
msgid "Destination Country"
msgstr ""

#: oec/explore/models.py:289
#: oec/explore/models.py:362
msgid "Product Name"
msgstr ""

#: oec/explore/models.py:328
#: oec/explore/models.py:401
msgid "Origin"
msgstr ""

#: oec/explore/models.py:343
#: oec/explore/models.py:416
msgid "Destination"
msgstr ""

#: oec/explore/models.py:361 oec/rankings/views.py:49 oec/rankings/views.py:53
#: oec/explore/models.py:434 oec/rankings/views.py:49 oec/rankings/views.py:53
msgid "Product"
msgstr ""

#: oec/explore/models.py:370
#: oec/explore/models.py:443
msgid "Trade Flow"
msgstr ""

#: oec/explore/models.py:373
#: oec/explore/models.py:446 oec/html/explore/embed.html:338
msgid "Export"
msgstr ""

#: oec/explore/models.py:374
#: oec/explore/models.py:447 oec/html/explore/embed.html:339
msgid "Import"
msgstr ""

#: oec/explore/models.py:381
#: oec/explore/models.py:454
msgid "Classification"
msgstr ""

#: oec/explore/models.py:395
#: oec/explore/models.py:468
msgid "Start Year"
msgstr ""

#: oec/explore/models.py:401
#: oec/explore/models.py:474
msgid "End Year"
msgstr ""

#: oec/explore/models.py:409 oec/rankings/views.py:75
#: oec/explore/models.py:482 oec/rankings/views.py:75
msgid "Year"
msgstr ""

Expand Down Expand Up @@ -121,23 +121,24 @@ msgstr ""
msgid "An emedded visualization."
msgstr ""

#: oec/html/explore/embed.html:13 oec/html/explore/embed.html:699
#: oec/html/explore/embed.html:13 oec/html/explore/embed.html:742
msgid "Loading"
msgstr ""

#: oec/html/explore/embed.html:20 oec/html/explore/embed.html:43
#: oec/html/explore/embed.html:20 oec/html/explore/embed.html:49
#: oec/html/explore/embed.html:335 oec/html/explore/embed.html:337
msgid "Value"
msgstr ""

#: oec/html/explore/embed.html:21 oec/html/explore/embed.html:118
msgid "Share"
#: oec/html/explore/embed.html:21 oec/html/explore/embed.html:332
msgid "Percent"
msgstr ""

#: oec/html/explore/embed.html:28
msgid "Continent"
msgstr ""

#: oec/html/explore/embed.html:29 oec/html/explore/embed.html:45
#: oec/html/explore/embed.html:29 oec/html/explore/embed.html:51
msgid "Category"
msgstr ""

Expand All @@ -149,71 +150,91 @@ msgstr ""
msgid "Full"
msgstr ""

#: oec/html/explore/embed.html:47
#: oec/html/explore/embed.html:42
msgid "Gross"
msgstr ""

#: oec/html/explore/embed.html:43
msgid "Net"
msgstr ""

#: oec/html/explore/embed.html:53
msgid "Annual Growth Rate (1 year)"
msgstr ""

#: oec/html/explore/embed.html:48
#: oec/html/explore/embed.html:54
msgid "Annual Growth Rate (5 year)"
msgstr ""

#: oec/html/explore/embed.html:49
#: oec/html/explore/embed.html:55
msgid "Growth Value (1 year)"
msgstr ""

#: oec/html/explore/embed.html:50
#: oec/html/explore/embed.html:56
msgid "Growth Value (5 year)"
msgstr ""

#: oec/html/explore/embed.html:54 oec/html/rankings/index.html:64
#: oec/html/explore/embed.html:60 oec/html/rankings/index.html:64
msgid "All Years"
msgstr ""

#: oec/html/explore/embed.html:65 oec/html/explore/embed.html:858
#: oec/html/explore/embed.html:71 oec/html/explore/embed.html:906
msgid "View as Text"
msgstr ""

#: oec/html/explore/embed.html:66
#: oec/html/explore/embed.html:72
msgid "Fullscreen"
msgstr ""

#: oec/html/explore/embed.html:102
#: oec/html/explore/embed.html:108
msgid "Build Visualization"
msgstr ""

#: oec/html/explore/embed.html:105 oec/html/rankings/index.html:59
#: oec/html/explore/embed.html:111 oec/html/rankings/index.html:59
msgid "Download"
msgstr ""

#: oec/html/explore/embed.html:113
#: oec/html/explore/embed.html:119
msgid "Embed"
msgstr ""

#: oec/html/explore/embed.html:134
#: oec/html/explore/embed.html:124
msgid "Share"
msgstr ""

#: oec/html/explore/embed.html:140
msgid "Short URL"
msgstr ""

#: oec/html/explore/embed.html:301
#: oec/html/explore/embed.html:334
msgid "Export Value"
msgstr ""

#: oec/html/explore/embed.html:302
#: oec/html/explore/embed.html:335
msgid "Net Export"
msgstr ""

#: oec/html/explore/embed.html:336
msgid "Import Value"
msgstr ""

#: oec/html/explore/embed.html:305
#: oec/html/explore/embed.html:337
msgid "Net Import"
msgstr ""

#: oec/html/explore/embed.html:342
msgid "value"
msgstr ""

#: oec/html/explore/embed.html:306
#: oec/html/explore/embed.html:343
msgid "percentage"
msgstr ""

#: oec/html/explore/embed.html:323
#: oec/html/explore/embed.html:361
msgid "Brought to you by"
msgstr ""

#: oec/html/explore/embed.html:853
#: oec/html/explore/embed.html:901
msgid "View as App"
msgstr ""

Expand Down
39 changes: 39 additions & 0 deletions oec/db_attr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ class Country(db.Model, AutoSerialize):
sitc_yod_origin = db.relationship("db_sitc.models.Yod", primaryjoin = ('db_sitc.models.Yod.origin_id == Country.id'), backref = 'origin', lazy = 'dynamic')
sitc_yop_origin = db.relationship("db_sitc.models.Yop", primaryjoin = ('db_sitc.models.Yop.origin_id == Country.id'), backref = 'origin', lazy = 'dynamic')

def get_attr_name(self, lang=None):
return self.name.filter_by(lang=lang).first()

def get_name(self, lang=None, article=None):
lang = lang or getattr(g, "locale", "en")
name = self.name.filter_by(lang=lang).first()
if name:
''' English '''
if lang == "en" and name.article and article:
return "The {0}".format(name.name)

''' French '''
if lang == "fr" and name.article and article:
if name.plural:
return u"les {0}".format(name.name)
Expand All @@ -48,6 +54,8 @@ def get_name(self, lang=None, article=None):
return u"le {0}".format(name.name)
elif name.gender == "f":
return u"la {0}".format(name.name)

''' Spanish '''
if lang == "es" and name.article and article:
if name.gender == "m":
if name.plural:
Expand All @@ -57,6 +65,37 @@ def get_name(self, lang=None, article=None):
if name.plural:
return u"las {0}".format(name.name)
return u"la {0}".format(name.name)

''' Italian '''
if lang == "it" and name.article and article:
if name.gender == "m":
if name.plural:
if any(vowel == name.name[0].lower() for vowel in ['a', 'e', 'i', 'o', 'u', 'y']):
return u"gli {0}".format(name.name)
if (name.name[0].lower() == "s"
and any(vowel == name.name[0].lower() for vowel in ['a', 'e', 'i', 'o', 'u', 'y'])) \
or name.name[0].lower() == "z":
return u"gli {0}".format(name.name)
return u"i {0}".format(name.name)
else:
if (name.name[0].lower() == "s"
and any(vowel == name.name[0].lower() for vowel in ['a', 'e', 'i', 'o', 'u', 'y'])) \
or name.name[0].lower() == "z":
return u"lo {0}".format(name.name)
if any(vowel == name.name[0].lower() for vowel in ['a', 'e', 'i', 'o', 'u', 'y']):
return u"l'{0}".format(name.name)
return u"il {0}".format(name.name)

elif name.gender == "f":
if name.plural:
if any(vowel == name.name[0].lower() for vowel in ['a', 'e', 'i', 'o', 'u', 'y']):
return u"le {0}".format(name.name)
return u"le {0}".format(name.name)
else:
if any(vowel == name.name[0].lower() for vowel in ['a', 'e', 'i', 'o', 'u', 'y']):
return u"l'{0}".format(name.name)
return u"la {0}".format(name.name)

return name.name
return ""

Expand Down
Loading

0 comments on commit e7e3d60

Please sign in to comment.