Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Russian translation #18

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@ de:

field_created_on_by_clock_time: "Angelegt (Uhrzeit)"
field_updated_on_by_clock_time: "Aktualisiert (Uhrzeit)"

label_orfilter: "ODER Filter"
label_orfilter_and_any: "UND einer der folgenden"
label_orfilter_or_any: "ODER einer der folgenden"
label_orfilter_or_all: "ODER alle folgenden"


6 changes: 6 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ en:
field_created_on_by_clock_time: "Created (Time of Day)"
field_updated_on_by_clock_time: "Updated (Time of Day)"

label_orfilter: "OR filters"
label_orfilter_and_any: "AND any following"
label_orfilter_or_any: "OR any following"
label_orfilter_or_all: "OR all following"
label_match: "match"
label_not_match: "not match"
7 changes: 7 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ja:
label_orfilter: "ORフィルタ"
label_orfilter_and_any: "上記 かつ (以下のいずれか)"
label_orfilter_or_any: "上記 または (以下のいずれか)"
label_orfilter_or_all: "上記 または (以下の全て)"
label_match: "match"
label_not_match: "not match"
68 changes: 68 additions & 0 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# encoding: utf-8
#
# Redmine plugin to add necessary filters to queries
#
# Copyright © 2019-2020 Stephan Wenzel <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

ru:

label_begins_with: "начинается с"
label_begins_with_any: "начинается с любого из"
label_not_begins_with: "не начинается с"
label_not_begins_with_any: "не начинается с любого из"

label_ends_with: "заканчивается на"
label_ends_with_any: "заканчивается на любой из"
label_not_ends_with: "не заканчивается на"
label_not_ends_with_any: "не заканчивается на любой из"

label_contains_any: "содержит любой из"
label_not_contains_any: "не содержит любой из"
label_contains_all: "содержит всё из"
label_not_contains_all: "не содержит ни один из"

label_any_of: "один из"
label_none_of: "ни один из"

label_tomorrow: "завтра"
label_next_week: "следующая неделя"
label_next_month: "следующий месяц"

label_is_strict: "является (точно)"
label_is_not_strict: "не является (точно)"

label_past: "прошлое"
label_future: "ожидается"

label_time: "время"
label_hour_plural: "часы"
label_between_ago: "с по"
label_less_than_hours_ago: "меньше чем часов тому назад"
label_more_than_hours_ago: "больше чем часов тому назад"
label_o_clock: "время"

field_created_on_by_clock_time: "Создано (время)"
field_updated_on_by_clock_time: "Изменено (время)"

label_orfilter: "ИЛИ фильтры"
label_orfilter_and_any: "И любое из следующих"
label_orfilter_or_any: "ИЛИ любое из следующих"
label_orfilter_or_all: "ИЛИ всё из следующих"
label_match: "соответствует"
label_not_match: "не соответствует"

44 changes: 21 additions & 23 deletions lib/redmine_more_filters/patches/database_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ module DatabasePatch
def self.included(base)
base.send(:include, InstanceMethods)
base.send(:extend, ClassMethods)

base.class_eval do
unloadable

end #base
end #self

module InstanceMethods
end

module ClassMethods
# Returns true if the database is a SQLServer
def sqlserver?
(ActiveRecord::Base.connection.adapter_name =~ /SQLServer/i).present?
end

# Returns a SQL statement for relative time
def relative_time( num, epoch )
if postgresql?
Expand All @@ -51,10 +51,10 @@ def relative_time( num, epoch )
"(DATEADD(#{epoch}, #{num}, CURRENT_TIMESTAMP))"
end
end #def

# Returns a SQL statement for local time
def local_time_sql( table_name, field, time_zone )

if postgresql?
"#{table_name}.#{field} at time zone '#{db_timezone.downcase}' at time zone '#{time_zone.downcase}'"
elsif mysql?
Expand All @@ -63,42 +63,43 @@ def local_time_sql( table_name, field, time_zone )
"Tzdb.ConvertZone(#{table_name}.#{field}, '#{db_timezone}', '#{time_zone}', 1, 1)"
end
end #def

# Returns a SQL statement for hour of local clock time
def local_clock_time_sql( table_name, field, time_zone )
"CAST(#{local_time_sql(table_name, field, time_zone)} AS TIME)"
end #def

# Returns a SQL statement for hour of local time
def hour_of_local_clock_time_sql( table_name, field, time_zone )
if postgresql?
if postgresql?
"CAST(DATE_PART('hour', #{local_clock_time_sql( table_name, field, time_zone)} ) AS INTEGER)"
elsif mysql?
"CAST(hour(#{local_clock_time_sql( table_name, field, time_zone)}) AS INTEGER)"
"CAST(hour(#{local_clock_time_sql( table_name, field, time_zone)}) AS UNSIGNED)"
elsif sqlserver?
"CAST(DATEPART('hour', #{local_clock_time_sql( table_name, field, time_zone)}) AS INTEGER)"
else
nil
end
end #def

def query_db_timezone
sql =
sql =
if postgresql?
"SELECT current_setting('TIMEZONE');"
elsif mysql?
"SELECT @@system_time_zone;"
#"SELECT @@system_time_zone;"
"SELECT 'UTC';"
elsif sqlserver?
"EXEC MASTER.dbo.xp_regread 'HKEY_LOCAL_MACHINE', 'SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation','TimeZoneKeyName'"
else
nil
end

if sql
result = ActiveRecord::Base.connection.exec_query(sql).rows[0]
end
timezone =

timezone =
if result.present?
if postgresql?
result[0]
Expand All @@ -112,13 +113,13 @@ def query_db_timezone
else
nil
end

end #def

def db_timezone
@db_timezone ||= query_db_timezone
end #def

end
end
end
Expand All @@ -127,6 +128,3 @@ def db_timezone
unless Redmine::Database.included_modules.include?(RedmineMoreFilters::Patches::DatabasePatch)
Redmine::Database.send(:include, RedmineMoreFilters::Patches::DatabasePatch)
end



27 changes: 21 additions & 6 deletions lib/redmine_more_filters/patches/issue_query_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,28 @@ def initialize_available_filters_with_more_filters

initialize_available_filters_without_more_filters

add_available_filter("created_on_by_clock_time",
:type => :time_past
)
add_available_filter("updated_on_by_clock_time",
:type => :time_past
)
add_available_filter("created_on_by_clock_time",
:type => :time_past
)
add_available_filter("updated_on_by_clock_time",
:type => :time_past
)

add_available_filter "and_any",
:name => l(:label_orfilter_and_any),
:type => :list,
:values => [l(:general_text_Yes)],
:group => 'or_filter'
add_available_filter "or_any",
:name => l(:label_orfilter_or_any),
:type => :list,
:values => [l(:general_text_Yes)],
:group => 'or_filter'
add_available_filter "or_all",
:name => l(:label_orfilter_or_all),
:type => :list,
:values => [l(:general_text_Yes)],
:group => 'or_filter'
end #def

def sql_for_created_on_by_clock_time_field(field, operator, value)
Expand Down
3 changes: 3 additions & 0 deletions lib/redmine_more_filters/patches/queries_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def filters_options_for_select_with_more_filters(query)
ungrouped = []
grouped = {}
query.available_filters.map do |field, field_options|
Rails.logger.warn field.to_s
if field_options[:type] == :relation
group = :label_relations
elsif field_options[:type] == :tree
Expand All @@ -75,6 +76,8 @@ def filters_options_for_select_with_more_filters(query)
group = :label_time
elsif field_options[:type] == :date_past || field_options[:type] == :date
group = :label_date
elsif field_options[:group] == 'or_filter'
group = :label_orfilter
end
if group
(grouped[group] ||= []) << [field_options[:name], field]
Expand Down
Loading