aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2010-02-17 09:26:59 +0100
committerStefan Ritter <xeno@thehappy.de>2010-02-17 09:26:59 +0100
commiteae87ee0ecebb6df34ad5c6086f0223c93e7d491 (patch)
treeb6fc9183594026fcf86990ae2b9c116d5e19adb3
parent5244d4b0dd71b140f4ba28cc3a4733b578c6682f (diff)
Added language option
* 'language' in section 'style' can be de, at, en, us, ...
-rwxr-xr-xblogthon.cgi25
-rw-r--r--configuration1
-rw-r--r--plugins/plugin_example.pycbin0 -> 309 bytes
3 files changed, 17 insertions, 9 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index 4cec664..c8c5a61 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -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 ''
diff --git a/configuration b/configuration
index 2ba3f00..8f7a91e 100644
--- a/configuration
+++ b/configuration
@@ -10,6 +10,7 @@ plugins_dir: plugins/
[look]
style: blogthon
+language: en
entries_per_page: 20
staticpages: True
monthlist: True
diff --git a/plugins/plugin_example.pyc b/plugins/plugin_example.pyc
new file mode 100644
index 0000000..99bb214
--- /dev/null
+++ b/plugins/plugin_example.pyc
Binary files differ