From 98b9ce8f978d9546097adbd98b9cfe7971a25cb1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=A0tefan=20Baebler?= Date: Fri, 12 Jun 2009 06:34:18 +0000 Subject: [PATCH] diary entries (list and rss) for a given language. TODO: language rss link, linking the localized lists --- app/controllers/diary_entry_controller.rb | 12 +++++++++--- config/locales/en.yml | 1 + config/locales/sl.yml | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb index 165f41306..2599bd479 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@ -68,6 +68,12 @@ class DiaryEntryController < ApplicationController render :action => 'no_such_user', :status => :not_found end + elsif params[:language] + @title = t 'diary_entry.list.in_language_title', :language => Language.find(params[:language]).english_name + @entry_pages, @entries = paginate(:diary_entries, :include => :user, + :conditions => ["users.visible = ? AND diary_entries.language_code = ?", true, params[:language]], + :order => 'created_at DESC', + :per_page => 20) else @title = t 'diary_entry.list.title' @entry_pages, @entries = paginate(:diary_entries, :include => :user, @@ -93,10 +99,10 @@ class DiaryEntryController < ApplicationController end elsif params[:language] @entries = DiaryEntry.find(:all, :include => :user, - :conditions => ["users.visible = ? AND diary_entries.language = ?", true, params[:language]], + :conditions => ["users.visible = ? AND diary_entries.language_code = ?", true, params[:language]], :order => 'created_at DESC', :limit => 20) - @title = "OpenStreetMap diary entries in #{params[:language]}" - @description = "Recent diary entries from users of OpenStreetMap" + @title = "OpenStreetMap diary entries in #{Language.find(params[:language]).english_name}" + @description = "Recent diary entries from users of OpenStreetMap in #{Language.find(params[:language]).english_name} language" @link = "http://#{SERVER_URL}/diary/#{params[:language]}" else @entries = DiaryEntry.find(:all, :include => :user, diff --git a/config/locales/en.yml b/config/locales/en.yml index 6e42e0306..b8a4955d4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -247,6 +247,7 @@ en: list: title: "Users' diaries" user_title: "{{user}}'s diary" + in_language_title: "Diary entries in {{language}} language" new: New Diary Entry new_title: Compose a new entry in your user diary no_entries: No diary entries diff --git a/config/locales/sl.yml b/config/locales/sl.yml index ccb7521d7..3e77d9797 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -245,7 +245,8 @@ sl: title: Nov zapis v dnevnik uporabnikov list: title: "Dnevniki uporabnikov" - user_title: "Dnavnik uporabnika {{user}}" + user_title: "Dnevnik uporabnika {{user}}" + in_language_title: "Dnevniki v jeziku {{language}}" new: Nov zapis v dnevnik uporabnikov new_title: Napišite nov zapis v vaš uporabniški dnevnik no_entries: Ni zapisov v dnevnik -- 2.39.5