filters translation

git-svn-id: http://redmine.rubyforge.org/svn/branches/work@87 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2006-12-16 10:45:03 +00:00
parent ded14f7c38
commit c524fd0423
9 changed files with 104 additions and 54 deletions

View File

@@ -29,6 +29,8 @@ class ProjectsController < ApplicationController
helper :ifpdf
include IfpdfHelper
helper IssuesHelper
helper :queries
include QueriesHelper
def index
list

View File

@@ -1,2 +1,6 @@
module QueriesHelper
def operators_for_select(filter_type)
Query.operators_by_filter_type[filter_type].collect {|o| [l(Query.operators[o]), o]}
end
end

View File

@@ -24,21 +24,23 @@ class Query < ActiveRecord::Base
validates_presence_of :name, :on => :save
@@operators = { "=" => "Egal",
"!" => "Different",
"o" => "Ouvert",
"c" => "Ferme",
"!*" => "Aucun",
"*" => "Tous",
"<t+" => "Dans moins de",
">t+" => "Dans plus de",
"t+" => "Dans exactement",
"t" => "Aujourd'hui",
">t-" => "Il y a moins de",
"<t-" => "Il y a plus de",
"t-" => "Il y a exactement",
"~" => "Contient",
"!~" => "Ne contient pas" }
@@operators = { "=" => :label_equals,
"!" => :label_not_equals,
"o" => :label_open_issues,
"c" => :label_closed_issues,
"!*" => :label_none,
"*" => :label_all,
"<t+" => :label_in_less_than,
">t+" => :label_in_more_than,
"t+" => :label_in,
"t" => :label_today,
">t-" => :label_less_than_ago,
"<t-" => :label_more_than_ago,
"t-" => :label_ago,
"~" => :label_contains,
"!~" => :label_not_contains }
cattr_reader :operators
@@operators_by_filter_type = { :list => [ "=", "!" ],
:list_status => [ "o", "=", "!", "c", "*" ],
@@ -46,7 +48,9 @@ class Query < ActiveRecord::Base
:date => [ "<t+", ">t+", "t+", "t", ">t-", "<t-", "t-" ],
:date_past => [ ">t-", "<t-", "t-", "t" ],
:text => [ "~", "!~" ] }
cattr_reader :operators_by_filter_type
def initialize(attributes = nil)
super attributes
self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
@@ -155,12 +159,7 @@ class Query < ActiveRecord::Base
when "!~"
sql = sql + "issues.#{field} NOT LIKE '%#{connection.quote_string(v.first)}%'"
end
end if filters
end if filters and valid?
sql
end
def self.operators_for_select(filter_type)
@@operators_by_filter_type[filter_type].collect {|o| [@@operators[o], o]}
end
end

View File

@@ -69,7 +69,7 @@ function toggle_multi_select(field) {
<label for="cb_<%= field %>"><%= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>
</td>
<td valign="top" width="150">
<%= select_tag "operators[#{field}]", options_for_select(Query.operators_for_select(options[:type]), query.operator_for(field)), :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %>
<%= select_tag "operators[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %>
</td>
<td valign="top">
<div id="values_div[<%= field %>]">
@@ -80,7 +80,7 @@ function toggle_multi_select(field) {
</select>
<%= link_to_function image_tag('expand'), "toggle_multi_select('#{field}');" %>
<% when :date, :date_past %>
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 3, :class => "select-small" %> jours
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 3, :class => "select-small" %> <%= l(:label_day_plural) %>
<% when :text %>
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 30, :class => "select-small" %>
<% end %>

View File

@@ -2,17 +2,14 @@
<!--[form:query]-->
<div class="box">
<div class="tabular">
<p><label for="query_name">Name</label>
<p><label for="query_name"><%=l(:field_name)%></label>
<%= text_field 'query', 'name', :size => 80 %></p>
<p><label for="query_is_public">Public</label>
<p><label for="query_is_public"><%=l(:field_is_public)%></label>
<%= check_box 'query', 'is_public' %></p>
</div>
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
</div>
<!--[eoform:query]-->
<!--[eoform:query]-->

View File

@@ -236,16 +236,16 @@ label_confirmation: Bestätigung
label_export_to: Export zu
label_read: Lesen...
label_public_projects: Öffentliche Projekte
label_open_issues: Geöffnet
label_open_issues_plural: Geöffnet
label_closed_issues: Geschlossen
label_closed_issues_plural: Geschlossen
label_open_issues: geöffnet
label_open_issues_plural: geöffnet
label_closed_issues: geschlossen
label_closed_issues_plural: geschlossen
label_total: Gesamtzahl
label_permissions: Berechtigungen
label_current_status: Gegenwärtiger Status
label_new_statuses_allowed: Neue Status gewährten
label_all: Alle
label_none: Kein
label_all: alle
label_none: kein
label_next: Weiter
label_previous: Zurück
label_used_by: Benutzt von
@@ -264,6 +264,18 @@ label_query_plural: Benutzerdefinierte Fragen
label_query_new: Neue Frage
label_filter_add: Filter addieren
label_filter_plural: Filter
label_equals: ist
label_not_equals: ist nicht
label_in_less_than: an weniger als
label_in_more_than: an mehr als
label_in: an
label_today: heute
label_less_than_ago: vor weniger als
label_more_than_ago: vor mehr als
label_ago: vor
label_contains: enthält
label_not_contains: enthält nicht
label_day_plural: Tage
button_login: Einloggen
button_submit: Einreichen

View File

@@ -236,16 +236,16 @@ label_confirmation: Confirmation
label_export_to: Export to
label_read: Read...
label_public_projects: Public projects
label_open_issues: Open
label_open_issues_plural: Open
label_closed_issues: Closed
label_closed_issues_plural: Closed
label_open_issues: open
label_open_issues_plural: open
label_closed_issues: closed
label_closed_issues_plural: closed
label_total: Total
label_permissions: Permissions
label_current_status: Current status
label_new_statuses_allowed: New statuses allowed
label_all: All
label_none: None
label_all: all
label_none: none
label_next: Next
label_previous: Previous
label_used_by: Used by
@@ -264,6 +264,18 @@ label_query_plural: Custom queries
label_query_new: New query
label_filter_add: Add filter
label_filter_plural: Filters
label_equals: is
label_not_equals: is not
label_in_less_than: in less than
label_in_more_than: in more than
label_in: in
label_today: today
label_less_than_ago: less than days ago
label_more_than_ago: more than days ago
label_ago: days ago
label_contains: contains
label_not_contains: doesn't contain
label_day_plural: days
button_login: Login
button_submit: Submit

View File

@@ -236,16 +236,16 @@ label_confirmation: Confirmación
label_export_to: Exportar a
label_read: Leer...
label_public_projects: Proyectos publicos
label_open_issues: Abierta
label_open_issues_plural: Abiertas
label_closed_issues: Cerrada
label_closed_issues_plural: Cerradas
label_open_issues: abierto
label_open_issues_plural: abiertos
label_closed_issues: cerrado
label_closed_issues_plural: cerrados
label_total: Total
label_permissions: Permisos
label_current_status: Estado actual
label_new_statuses_allowed: Nuevos estatutos autorizados
label_all: Todos
label_none: Ninguno
label_all: todos
label_none: ninguno
label_next: Próximo
label_previous: Precedente
label_used_by: Utilizado por
@@ -264,6 +264,18 @@ label_query_plural: Preguntas personalizadas
label_query_new: Nueva preguntas
label_filter_add: Agregar el filtro
label_filter_plural: Filtros
label_equals: igual
label_not_equals: no igual
label_in_less_than: en menos que
label_in_more_than: en más que
label_in: en
label_today: hoy
label_less_than_ago: hace menos de
label_more_than_ago: hace más de
label_ago: hace
label_contains: contiene
label_not_contains: no contiene
label_day_plural: días
button_login: Conexión
button_submit: Someter

View File

@@ -237,16 +237,16 @@ label_confirmation: Confirmation
label_export_to: Exporter en
label_read: Lire...
label_public_projects: Projets publics
label_open_issues: Ouverte
label_open_issues_plural: Ouvertes
label_closed_issues: Fermée
label_closed_issues_plural: Fermées
label_open_issues: ouvert
label_open_issues_plural: ouverts
label_closed_issues: fermé
label_closed_issues_plural: fermés
label_total: Total
label_permissions: Permissions
label_current_status: Statut actuel
label_new_statuses_allowed: Nouveaux statuts autorisés
label_all: Tous
label_none: Aucun
label_all: tous
label_none: aucun
label_next: Suivant
label_previous: Précédent
label_used_by: Utilisé par
@@ -265,6 +265,18 @@ label_query_plural: Rapports personnalisés
label_query_new: Nouveau rapport
label_filter_add: Ajouter le filtre
label_filter_plural: Filtres
label_equals: égal
label_not_equals: différent
label_in_less_than: dans moins de
label_in_more_than: dans plus de
label_in: dans
label_today: aujourd'hui
label_less_than_ago: il y a moins de
label_more_than_ago: il y a plus de
label_ago: il y a
label_contains: contient
label_not_contains: ne contient pas
label_day_plural: jours
button_login: Connexion
button_submit: Soumettre