Merge lp:~daker/loco-team-portal/fix.621167 into lp:loco-team-portal

Proposed by Adnane Belmadiaf
Status: Work in progress
Proposed branch: lp:~daker/loco-team-portal/fix.621167
Merge into: lp:loco-team-portal
Diff against target: 104 lines (+61/-2)
4 files modified
loco_directory/common/context_processors.py (+4/-0)
loco_directory/common/languages.py (+54/-0)
loco_directory/settings.py (+1/-0)
loco_directory/templates/base.html (+2/-2)
To merge this branch: bzr merge lp:~daker/loco-team-portal/fix.621167
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Needs Information
Review via email: mp+33272@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

 - What happens to languages that might be added as translations that are not defined in the context preprocessor?
 - langues → languages?
 - Is there a way to get the list of translated language names somehow automatically?

review: Needs Information
Revision history for this message
Adnane Belmadiaf (daker) wrote :

> - What happens to languages that might be added as translations that are not defined in the context preprocessor?
When a languages is added as translation if it's not in languages.py it should be added then it will appear automatically

> - langues → languages?
Why not, that a mistake it was noticed by mhall119

> - Is there a way to get the list of translated language names somehow automatically?
For many uses this is not very useful as it's preferred to display the language name in its native language

254. By Adnane Belmadiaf

* Changed langues to languages

Revision history for this message
Daniel Holbach (dholbach) wrote :

> > - Is there a way to get the list of translated language names somehow
> automatically?
> For many uses this is not very useful as it's preferred to display the
> language name in its native language

Can you try to elaborate? I'm not sure I understand.

Revision history for this message
Adnane Belmadiaf (daker) wrote :

> Can you try to elaborate? I'm not sure I understand.

so basically the list of languages should be displayed in native names, we don't need to display a translated version of the language names.

Ex : Wikipedia languages menu

Revision history for this message
Daniel Holbach (dholbach) wrote :

Sure, I agree with the problem at hand. I just thought there might be an automated way of getting a list of translated language names just like we do for getting country names or language names (in English right now).

If there's no way, that's fine with me. We should probably file a bug to get that info from Launchpad too.

Revision history for this message
Daniel Holbach (dholbach) wrote :

I filed bug 624530. Maybe there's another way.

Revision history for this message
Adnane Belmadiaf (daker) wrote :

That would be great if we can get them directly from LP

Revision history for this message
Daniel Holbach (dholbach) wrote :

Ok, I'm generally happy and think we should just wait for the Launchpad bug to be fixed. One more small question: why are some languages lower-cased and some others upper-cased? Is that a problem?

Revision history for this message
Adnane Belmadiaf (daker) wrote :

ah yes it's a mistake, some of them are written in lower-case & the others are in upper-case.

Unmerged revisions

254. By Adnane Belmadiaf

* Changed langues to languages

253. By Adnane Belmadiaf

Fixed bug #621167

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/common/context_processors.py'
2--- loco_directory/common/context_processors.py 2010-07-28 13:13:39 +0000
3+++ loco_directory/common/context_processors.py 2010-08-23 13:41:14 +0000
4@@ -3,6 +3,7 @@
5 # to use this processor, add "common.context_processors.loco_version" to your variable TEMPLATE_CONTEXT_PROCESSORS in your settings file
6
7 from django.conf import settings
8+from languages import LANGUAGES
9
10 def loco_version(request):
11 """
12@@ -32,3 +33,6 @@
13 def url_base(request):
14 url = request.get_full_path().split('/')
15 return {'url_base': url[1]}
16+
17+def languages(request):
18+ return {'languages': LANGUAGES}
19
20=== added file 'loco_directory/common/languages.py'
21--- loco_directory/common/languages.py 1970-01-01 00:00:00 +0000
22+++ loco_directory/common/languages.py 2010-08-23 13:41:14 +0000
23@@ -0,0 +1,54 @@
24+# -*-: coding: utf-8 -*-
25+
26+
27+LANGUAGES = {
28+ 'ar': ['Arabic', u'العربية'],
29+ 'bg': ['Bulgarian', u'български език'],
30+ 'bn': ['Bengali', u'বাংলা'],
31+ 'ca': ['Catalan', u'català'],
32+ 'cs': ['Czech', u'česky'],
33+ 'cy': ['Welsh', u'Cymraeg'],
34+ 'da': ['Danish', u'dansk'],
35+ 'de': ['German', u'Deutsch'],
36+ 'el': ['Greek', u'Ελληνικά'],
37+ 'en': ['English', u'English'],
38+ 'es': ['Spanish', u'español'],
39+ 'es_AR': ['Argentinean Spanish', u'Argentinean Spanish'],
40+ 'et': ['Estonian', u'eesti keel'],
41+ 'eu': ['Basque', u'euskara'],
42+ 'fa': ['Persian', u'فارسی'],
43+ 'fi': ['Finnish', u'suomi'],
44+ 'fr': ['French', u'français'],
45+ 'ga': ['Irish', u'Gaeilge'],
46+ 'gl': ['Galician', u'Galego'],
47+ 'he': ['Hebrew', u'עִבְרִית; עברית'],
48+ 'hr': ['Croatian', u'hrvatski jezik'],
49+ 'hu': ['Hungarian', u'magyar'],
50+ 'is': ['Icelandic', u'íslenska'],
51+ 'it': ['Italian', u'italiano'],
52+ 'ja': ['Japanese', u'日本語 '],
53+ 'ka': ['Georgian', u'ქართული ენა (kartuli ena)'],
54+ 'km': ['Khmer', u'ភាសាខ្មែរ'],
55+ 'kn': ['Kannada', u'ಕನ್ನಡ'],
56+ 'ko': ['Korean', u'韓國語'],
57+ 'lt': ['Lithuanian', u'lietuvių kalba'],
58+ 'lv': ['Latvian', u'latviešu valoda'],
59+ 'mk': ['Macedonian', u'македонски јазик'],
60+ 'nl': ['Dutch', u'Nederlands'],
61+ 'no': ['Norwegian', u'Norsk'],
62+ 'pl': ['Polish', u'polski'],
63+ 'pt': ['Portugese', u'português'],
64+ 'pt_BR': ['Brazilian Portuguese', u'Brazilian Portuguese'],
65+ 'ro': ['Romanian', u'română'],
66+ 'ru': ['Russian', u'русский язык'],
67+ 'sk': ['Slovak', u'slovenčina'],
68+ 'sl': ['Slovenian', u'slovenščina'],
69+ 'sr': ['Serbian', u'српски језик'],
70+ 'sv': ['Swedish', u'Svenska'],
71+ 'ta': ['Tamil', u'தமிழ்'],
72+ 'te': ['Telugu', u'తెలుగు'],
73+ 'tr': ['Turkish', u'Türkçe'],
74+ 'uk': ['Ukrainian', u'українська мова'],
75+ 'zh_CN': ['Simplified Chinese', u'中文'],
76+ 'zh_TW': ['Traditional Chinese', u' 中文']
77+}
78
79=== modified file 'loco_directory/settings.py'
80--- loco_directory/settings.py 2010-08-20 13:05:47 +0000
81+++ loco_directory/settings.py 2010-08-23 13:41:14 +0000
82@@ -86,6 +86,7 @@
83 "common.context_processors.google_api_key",
84 "common.context_processors.login_redirect",
85 "common.context_processors.url_base",
86+ "common.context_processors.languages",
87 )
88
89 ROOT_URLCONF = 'loco_directory.urls'
90
91=== modified file 'loco_directory/templates/base.html'
92--- loco_directory/templates/base.html 2010-08-20 13:05:47 +0000
93+++ loco_directory/templates/base.html 2010-08-23 13:41:14 +0000
94@@ -45,8 +45,8 @@
95 <form name="lang-switcher" style="text-align:right;" action="/language/" method="get">
96 <input name="next" type="hidden" value="{{ request.path }}" />
97 <select name="lang" onchange="document.forms['lang-switcher'].submit()">
98- {% for lang in LANGUAGES %}
99- <option value="{{ lang.0 }}"{% ifequal LANGUAGE_CODE lang.0 %} selected="selected"{% endifequal %}>{{ lang.1 }}</option>
100+ {% for code, language in languages.items %}
101+ <option value="{{ code }}"{% ifequal LANGUAGE_CODE code %} selected="selected"{% endifequal %}>{{ language.1 }}</option>
102 {% endfor %}
103 </select>
104 </form>

Subscribers

People subscribed via source and target branches