Added language option

* 'language' in section 'style' can be de, at, en, us, ...
This commit is contained in:
Stefan Ritter 2010-02-17 09:26:59 +01:00
parent 5244d4b0dd
commit eae87ee0ec
3 changed files with 17 additions and 9 deletions

View File

@ -109,6 +109,13 @@ if not os.path.exists(plugins_dir):
try: style = configuration.get('look', 'style')
except: errorpage('"style" is missing in configuration!')
try: language = configuration.get('look', 'language')
except: errorpage('"language" is missing in configuration!')
if language == "de" or language == "at":
locale = ("Seiten", "Monate", "Links", "Keine Kommentare", "Kommentare", "Alle Einträge anzeigen...", "Name", "Text", "Absenden")
else:
locale = ("pages", "months", "links", "no comments", "comments", "View all entries...", "name", "text", "commit")
try: entries_per_page = configuration.getint('look', 'entries_per_page')
except: errorpage('"entries_per_page" is missing in configuration!')
@ -346,7 +353,7 @@ else:
staticpages_list = glob.glob(staticpages_dir + '*')
staticpages_list.sort()
print ' <div class="pages">'
print ' <div class="pages_title">pages</div>'
print ' <div class="pages_title">' + locale[0] + '</div>'
print ' <div class="pages_list">'
print ' <ul class="pages_list">'
for staticpage in staticpages_list:
@ -370,7 +377,7 @@ else:
if monthlist == "True":
olddate = ""
print ' <div class="months">'
print ' <div class="months_title">months</div>'
print ' <div class="months_title">' + locale[1] + '</div>'
print ' <div class="months_list">'
print ' <ul class="months_list">'
for entry in entries:
@ -388,7 +395,7 @@ else:
# Linklist
if linklist == "True":
print ' <div class="linklist">'
print ' <div class="linklist_title">links</div>'
print ' <div class="linklist_title">' + locale[2] + '</div>'
print ' <div class="linklist_list">'
print ' <ul class="linklist_list">'
try:
@ -519,10 +526,10 @@ else:
print ' <form action="" method="post">'
print ' <input type="hidden" name="ctitle" value="' + title + '" />'
print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
print ' <label class="submit_comment_name">name:</label><input class="submit_comment_name_input" type="text" id="cname" name="cname" />'
print ' <br /><label class="submit_comment_text">text:</label><textarea class="submit_comment_textarea" id="ctext" name="ctext"></textarea>'
print ' <label class="submit_comment_name">' + locale[6] + ':</label><input class="submit_comment_name_input" type="text" id="cname" name="cname" />'
print ' <br /><label class="submit_comment_text">' + locale[7] + ':</label><textarea class="submit_comment_textarea" id="ctext" name="ctext"></textarea>'
print ' <br /><label class="submit_comment_quiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input class="submit_comment_quiz_input" type="text" id="cquiz" name="cquiz" />'
print ' <br /><input class="submit_comment_button" type="submit" id="submit" value="post comment" />'
print ' <br /><input class="submit_comment_button" type="submit" id="submit" value="' + locale[8] + '" />'
print ' </form>'
print ' </div>'
else:
@ -533,7 +540,7 @@ else:
comments_file = glob.glob(entries_dir + title + '.comments')
if not comments_file and not post_display:
print ' <div class="entry_comment">'
print ' <a href="?p=' + title.replace(' ','-') + '" class="entry_comment">no comments</a>'
print ' <a href="?p=' + title.replace(' ','-') + '" class="entry_comment">' + locale[3] + '</a>'
print ' </div>'
print ' </div>'
print ''
@ -543,7 +550,7 @@ else:
for line in comments_content:
if line.split(".", 1)[0] == "-": comments_counter += 1
print ' <div class="entry_comment">'
print ' <a href="?p=' + title.replace(' ', '-') + '" class="entry_comment">comments (' + str(comments_counter) + ')</a>'
print ' <a href="?p=' + title.replace(' ', '-') + '" class="entry_comment">' + locale[4] + ' (' + str(comments_counter) + ')</a>'
print ' </div>'
print ' </div>'
print ''
@ -556,7 +563,7 @@ else:
entry_counter += 1
if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist
print ' <div class="entry"><a href=?a=1>View all entries...</a></div>'
print ' <div class="entry"><a href=?a=1>' + locale[5] + '</a></div>'
print ' </div>'
print ''

View File

@ -10,6 +10,7 @@ plugins_dir: plugins/
[look]
style: blogthon
language: en
entries_per_page: 20
staticpages: True
monthlist: True

BIN
plugins/plugin_example.pyc Normal file

Binary file not shown.