From: Ævar Arnfjörð Bjarmason Date: Sun, 7 Jun 2009 21:10:34 +0000 (+0000) Subject: Edgemaster & shaunmcdonald pointed out that my ad-hoc hackery was X-Git-Tag: live~7697 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/1f92b6f35b43fa36e42a924fb5561d889120e457?hp=887eba8c8dda1eaea0a6d4785a443798da6f80b7 Edgemaster & shaunmcdonald pointed out that my ad-hoc hackery was covered by i18n translation framework. So use the magical :count argument. Also convert {{size}} to {{count}} in layouts.inbox --- diff --git a/app/views/layouts/site.rhtml b/app/views/layouts/site.rhtml index ae16bbf99..105244611 100644 --- a/app/views/layouts/site.rhtml +++ b/app/views/layouts/site.rhtml @@ -24,7 +24,12 @@ <% if @user and @user.id %> <%= t 'layouts.welcome_user', :user_link => (link_to h(@user.display_name), {:controller => 'user', :action => 'view', :display_name => @user.display_name}, :title => t('layouts.welcome_user_link_tooltip')) %> | <%= yield :greeting %> - <%= link_to t('layouts.inbox', :size => @user.new_messages.size), {:controller => 'message', :action => 'inbox', :display_name => @user.display_name}, case @user.new_messages.size when 0 then { :title => t('layouts.inbox_tooltip_0') } when 1 then { :class => 'greeting-bar-unread', :title => t('layouts.inbox_tooltip_1') } else { :class => 'greeting-bar-unread', :title => t('layouts.inbox_tooltip_n', :size => @user.new_messages.size) } end %> | + <% + inbox_attributes = {} + inbox_attributes[:class] = 'greeting-bar-unread' if @user.new_messages.size > 0 + inbox_attributes[:title] = t 'layouts.inbox_tooltip', :count => @user.new_messages.size + %> + <%= link_to t('layouts.inbox', :count => @user.new_messages.size), {:controller => 'message', :action => 'inbox', :display_name => @user.display_name}, inbox_attributes %> | <%= link_to t('layouts.logout'), {:controller => 'user', :action => 'logout', :referer => request.request_uri}, {:id => 'logoutanchor', :title => t('layouts.logout_tooltip')}%> <% else %> <%= link_to t('layouts.log_in'), {:controller => 'user', :action => 'login', :referer => request.request_uri}, {:id => 'loginanchor', :title => t('layouts.log_in_tooltip')} %> diff --git a/config/locales/be.yml b/config/locales/be.yml index 731e81cc9..174e73217 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -296,7 +296,7 @@ be: layouts: welcome_user: "Вітаем, {{user_link}}" home: "дамоў" - inbox: "уваходныя ({{size}})" + inbox: "уваходныя ({{count}})" logout: выйсці log_in: увайсці sign_up: зарэгістравацца diff --git a/config/locales/de.yml b/config/locales/de.yml index 764f40f09..9dd9f5827 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -324,7 +324,7 @@ de: layouts: welcome_user: "Willkommen, {{user_link}}" home: "home" - inbox: "Posteingang ({{size}})" + inbox: "Posteingang ({{count}})" logout: Abmelden log_in: Anmelden sign_up: Registrieren diff --git a/config/locales/en.yml b/config/locales/en.yml index b9dcea3ed..396fd28d6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -335,10 +335,11 @@ en: welcome_user_link_tooltip: Your user page home: home home_tooltip: Go to home location - inbox: "inbox ({{size}})" - inbox_tooltip_0: Your inbox contains no unread messages - inbox_tooltip_1: Your inbox contians 1 unread message - inbox_tooltip_n: Your inbox contains {{size}} unread messages + inbox: "inbox ({{count}})" + inbox_tooltip: + zero: Your inbox contains no unread messages + one: Your inbox contians 1 unread message + other: Your inbox contains {{count}} unread messages logout: logout logout_tooltip: "Log out" log_in: log in diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 50ffa7ac7..c4c734b46 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -111,7 +111,7 @@ fr: comment_from: "Commentaire de {{link_user}} le {{comment_created_at}}" layouts: welcome_user: "Bienvenue, {{user_link}}" - inbox: "Boite aux lettres ({{size}})" + inbox: "Boite aux lettres ({{count}})" logout: "Déconnexion" log_in: "Connexion" sign_up: "S'inscrire" diff --git a/config/locales/he.yml b/config/locales/he.yml index 9a89c04c5..d8caf33cb 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -297,7 +297,7 @@ he: layouts: welcome_user: "Welcome, {{user_link}}" home: "home" - inbox: "inbox ({{size}})" + inbox: "inbox ({{count}})" logout: logout log_in: log in sign_up: sign up diff --git a/config/locales/is.yml b/config/locales/is.yml index 710437fe8..810b9611f 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -323,7 +323,7 @@ is: layouts: welcome_user: "Hæ {{user_link}}" home: "heim" - inbox: "innhólf ({{size}})" + inbox: "innhólf ({{count}})" logout: "útskrá" log_in: "innskrá" sign_up: "búa til aðgang" diff --git a/config/locales/it.yml b/config/locales/it.yml index b2b227668..265154773 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -297,7 +297,7 @@ it: layouts: welcome_user: "Benvenuto, {{user_link}}" home: "posizione iniziale" - inbox: "in arrivo ({{size}})" + inbox: "in arrivo ({{count}})" logout: esci log_in: entra sign_up: iscriviti diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 73f92c444..f8a4ffe8f 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -297,7 +297,7 @@ nl: layouts: welcome_user: "Welkom, {{user_link}}" home: "home" - inbox: "Postvak IN ({{size}})" + inbox: "Postvak IN ({{count}})" logout: uitloggen log_in: inloggen sign_up: registreren diff --git a/config/locales/pl.yml b/config/locales/pl.yml index da9b1626e..31bec632d 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -300,7 +300,7 @@ pl: layouts: welcome_user: "Witaj, {{user_link}}" home: "główna" - inbox: "skrzynka ({{size}})" + inbox: "skrzynka ({{count}})" logout: wyloguj log_in: zaloguj się sign_up: zarejestruj diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 9d0de5709..71cd85391 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -297,7 +297,7 @@ ru: layouts: welcome_user: "Добро пожаловать, {{user_link}}" home: "домой" - inbox: "входящие ({{size}})" + inbox: "входящие ({{count}})" logout: выйти log_in: войти sign_up: регистрация diff --git a/config/locales/sl.yml b/config/locales/sl.yml index df023fbc0..7d0f4bbdd 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -326,7 +326,7 @@ sl: layouts: welcome_user: "DobrodoÅ¡li, {{user_link}}" home: "domov" - inbox: "prejeta poÅ¡ta ({{size}})" + inbox: "prejeta poÅ¡ta ({{count}})" logout: odjava log_in: prijava sign_up: vpis diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 95213a6e1..6391c7a9a 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -295,7 +295,7 @@ zh-CN: layouts: welcome_user: "Welcome, {{user_link}}" home: "home" - inbox: "inbox ({{size}})" + inbox: "inbox ({{count}})" logout: logout log_in: log in sign_up: sign up