Skip to content

Commit

Permalink
Merge pull request #13607 from opf/bugfix/49848-fix-untranslated-strings
Browse files Browse the repository at this point in the history
[49848] Fix some untranslated strings
  • Loading branch information
ulferts committed Sep 4, 2023
2 parents 7722be4 + 3871a47 commit 9d7eae1
Show file tree
Hide file tree
Showing 35 changed files with 149 additions and 92 deletions.
9 changes: 4 additions & 5 deletions app/views/admin/plugins.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,21 @@ See COPYRIGHT and LICENSE files for more details.
<% @plugins.each do |plugin| %>
<tr>
<td><span class="name"><%=h plugin.name %></span>
<%= content_tag('span', h(plugin.description), class: 'description') unless plugin.description.blank? %>
<%= content_tag('span', link_to(h(plugin.url), plugin.url), class: 'url') unless plugin.url.blank? %>
<%= content_tag('span', plugin.description, class: 'description') if plugin.description.present? %>
<%= content_tag('span', link_to(plugin.url, plugin.url), class: 'url') if plugin.url.present? %>
</td>
<td class="author"><%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %></td>
<td class="author"><%= plugin.author_url.blank? ? plugin.author : link_to(plugin.author, plugin.author_url) %></td>
<td class="version">
<% if plugin.bundled %>
<%= t(:label_bundled) %>
<% else %>
<%= h plugin.version %>
<%= plugin.version %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>

</div>
</div>
<% else %>
Expand Down
1 change: 1 addition & 0 deletions config/initializers/menus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
# Work packages
menu.push :work_packages,
{ controller: '/work_packages', action: 'index' },
caption: :label_work_package_plural,
icon: 'view-timeline',
after: :activity

Expand Down
7 changes: 7 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3373,3 +3373,10 @@ en:
unexpected: "Unexpected response received."

you: you

plugin_openproject_auth_plugins:
name: "OpenProject Auth Plugins"
description: "Integration of OmniAuth strategy providers for authentication in Openproject."
plugin_openproject_auth_saml:
name: "OmniAuth SAML / Single-Sign On"
description: "Adds the OmniAuth SAML provider to OpenProject"
4 changes: 3 additions & 1 deletion frontend/src/app/core/setup/init-locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export function initializeLocale() {
I18n.locale = locale;

if (!Number.isNaN(firstDayOfWeek) && !Number.isNaN(firstWeekOfYear)) {
moment.updateLocale(locale, {
// ensure locale like "zh-CN" falls back to "zh-cn"
moment.locale(locale);
moment.updateLocale(moment.locale(), {
week: {
dow: firstDayOfWeek,
doy: 7 + firstDayOfWeek - firstWeekOfYear,
Expand Down
5 changes: 2 additions & 3 deletions lib/open_project/plugins/acts_as_op_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,11 @@ def additional_permitted_attributes(attributes)
# block: Pass a block to the plugin (for defining permissions, menu items and the like)
def register(gem_name, options, &block)
self.class.initializer "#{engine_name}.register_plugin" do
spec = Bundler.load.specs[gem_name][0]
spec = Gem.loaded_specs[gem_name]

p = Redmine::Plugin.register engine_name.to_sym do
name spec.summary
gem_name spec.name
author spec.authors.is_a?(Array) ? spec.authors[0] : spec.authors
description spec.description
version spec.version
url spec.homepage

Expand Down
46 changes: 0 additions & 46 deletions lib/redmine/about.rb

This file was deleted.

34 changes: 20 additions & 14 deletions lib/redmine/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def def_field(*names)
end
end
end
def_field :description, :url, :author, :author_url, :version, :settings, :bundled
def_field :gem_name, :url, :author, :author_url, :version, :settings, :bundled
attr_reader :id

# Plugin constructor
Expand Down Expand Up @@ -133,15 +133,21 @@ def self.register(id, &block)
def name(*args)
name = args.empty? ? instance_variable_get("@name") : instance_variable_set("@name", *args)

case name
when Symbol
::I18n.t(name)
when NilClass
# Default name if it was not provided during registration
id.to_s.humanize
else
name
end
return ::I18n.t(name) if name.is_a?(Symbol)
return name if name

translated_name = ::I18n.t("plugin_#{id}.name", default: nil)
translated_name || gemspec&.summary || id.to_s.humanize
end

def description(*args)
description = args.empty? ? instance_variable_get("@description") : instance_variable_set("@description", *args)

description || ::I18n.t("plugin_#{id}.description", default: gemspec&.description)
end

def gemspec
Gem.loaded_specs[gem_name]
end

# returns an array of all dependencies we know of for plugin id
Expand Down Expand Up @@ -201,8 +207,8 @@ def <=>(other)
# # Requires OpenProject between 1.1.0 and 1.1.5 or higher
# requires_openproject ">= 1.1.0", "<= 1.1.5"

def requires_openproject(*args)
required_version = Gem::Requirement.new(*args)
def requires_openproject(*)
required_version = Gem::Requirement.new(*)
op_version = Gem::Version.new(OpenProject::VERSION.to_semver)

unless required_version.satisfied_by? op_version
Expand Down Expand Up @@ -362,9 +368,9 @@ def project_module(name, options = {}, &)
# Meeting.find_events('scrums', User.current, 5.days.ago, Date.today, project: foo) # events for project foo only
#
# Note that :view_scrums permission is required to view these events in the activity view.
def activity_provider(*args)
def activity_provider(*)
ActiveSupport::Deprecation.warn('Use ActsAsOpEngine#activity_provider instead.')
OpenProject::Activity.register(*args)
OpenProject::Activity.register(*)
end

# Registers a wiki formatter.
Expand Down
9 changes: 6 additions & 3 deletions modules/avatars/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# English strings go here
en:
plugin_openproject_avatars:
name: "Avatars"
description: >-
This plugin allows OpenProject users to upload a picture to be used as an avatar or use
registered images from Gravatar.
label_avatar: "Avatar"
label_avatar_plural: "Avatars"
label_current_avatar: "Current Avatar"
Expand Down Expand Up @@ -36,6 +42,3 @@ en:
enable_gravatars: 'Enable user gravatars'
gravatar_default: "Default Gravatar image"
enable_local_avatars: 'Enable user custom avatars'



1 change: 0 additions & 1 deletion modules/avatars/lib/open_project/avatars/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Engine < ::Rails::Engine
partial: 'settings/openproject_avatars',
menu_item: :user_avatars
},
name: :label_avatar_plural,
bundled: true do
add_menu_item :my_menu, :avatar,
{ controller: '/avatars/my_avatar', action: 'show' },
Expand Down
4 changes: 4 additions & 0 deletions modules/backlogs/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

---
en:
plugin_openproject_backlogs:
name: "OpenProject Backlogs"
description: "This module adds features enabling agile teams to work with OpenProject in Scrum projects."

activerecord:
attributes:
work_package:
Expand Down
4 changes: 4 additions & 0 deletions modules/bim/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# English strings go here for Rails i18n
en:
plugin_openproject_bim:
name: "OpenProject BIM and BCF functionality"
description: "This OpenProject plugin introduces BIM and BCF functionality."

bim:
label_bim: 'BIM'

Expand Down
6 changes: 5 additions & 1 deletion modules/boards/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# English strings go here
en:
plugin_openproject_boards:
name: "OpenProject Boards"
description: "Provides board views."

permission_show_board_views: "View boards"
permission_manage_board_views: "Manage boards"
project_module_board_view: "Boards"
Expand Down Expand Up @@ -35,7 +39,7 @@ en:
Board with automated columns for subprojects.
Dragging work packages to other lists updates the (sub-)project accordingly.
subtasks: >
Board with automated columns for sub-elements.
Board with automated columns for sub-elements.
Dragging work packages to other lists updates the parent accordingly.
upsale:
Expand Down
7 changes: 3 additions & 4 deletions modules/boards/lib/open_project/boards/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class Engine < ::Rails::Engine
register 'openproject-boards',
author_url: 'https://www.openproject.org',
bundled: true,
settings: {},
name: 'OpenProject Boards' do
settings: {} do
project_module :board_view, dependencies: :work_package_tracking, order: 80 do
permission :show_board_views,
{ 'boards/boards': %i[index show] },
Expand Down Expand Up @@ -54,8 +53,8 @@ class Engine < ::Rails::Engine
caption: :'boards.label_boards'

should_render_global_menu_item = Proc.new do
(User.current.logged? || !Setting.login_required?) &&
User.current.allowed_to_globally?(:show_board_views)
(User.current.logged? || !Setting.login_required?) &&
User.current.allowed_to_globally?(:show_board_views)
end

menu :top_menu,
Expand Down
3 changes: 3 additions & 0 deletions modules/budgets/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

---
en:
plugin_budgets_engine:
name: 'Budgets'

activerecord:
attributes:
budget:
Expand Down
3 changes: 1 addition & 2 deletions modules/budgets/lib/budgets/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ class Engine < ::Rails::Engine

register 'budgets',
author_url: 'https://www.openproject.org',
bundled: true,
name: 'Budgets' do
bundled: true do
project_module :budgets do
permission :view_budgets, { budgets: %i[index show] }
permission :edit_budgets, { budgets: %i[index show edit update destroy destroy_info new create copy] }
Expand Down
4 changes: 4 additions & 0 deletions modules/calendar/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# English strings go here
en:
plugin_openproject_calendar:
name: "OpenProject Calendar"
description: "Provides calendar views."

label_calendar: "Calendar"
label_calendar_plural: "Calendars"
label_new_calendar: "New calendar"
Expand Down
3 changes: 1 addition & 2 deletions modules/calendar/lib/open_project/calendar/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class Engine < ::Rails::Engine
register 'openproject-calendar',
author_url: 'https://www.openproject.org',
bundled: true,
settings: {},
name: 'OpenProject Calendar' do
settings: {} do
project_module :calendar_view, dependencies: :work_package_tracking do
permission :view_calendar,
{ 'calendar/calendars': %i[index show] },
Expand Down
4 changes: 4 additions & 0 deletions modules/costs/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

---
en:
plugin_costs:
name: "Time and costs"
description: "This module adds features for planning and tracking costs of projects."

activerecord:
attributes:
cost_entry:
Expand Down
3 changes: 1 addition & 2 deletions modules/costs/lib/costs/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class Engine < ::Rails::Engine
default: { 'costs_currency' => 'EUR', 'costs_currency_format' => '%n %u' },
partial: 'settings/costs',
menu_item: :costs_setting
},
name: :project_module_costs do
} do
project_module :costs do
permission :view_time_entries, {}
permission :view_own_time_entries, {}
Expand Down
4 changes: 4 additions & 0 deletions modules/documents/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#++

en:
plugin_openproject_documents:
name: "OpenProject Documents"
description: "An OpenProject plugin to allow creation of documents in projects."

activerecord:
models:
document: "Document"
Expand Down
5 changes: 4 additions & 1 deletion modules/github_integration/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#++

en:
plugin_openproject_github_integration:
name: "OpenProject GitHub Integration"
description: "Integrates OpenProject and GitHub for a better workflow"

project_module_github: "GitHub"
permission_show_github_content: "Show GitHub content"

4 changes: 4 additions & 0 deletions modules/job_status/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
en:
plugin_openproject_job_status:
name: "OpenProject Job status"
description: "Listing and status of background jobs."
4 changes: 3 additions & 1 deletion modules/ldap_groups/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
en:
plugin_openproject_ldap_groups:
name: "OpenProject LDAP groups"
description: "Synchronization of LDAP group memberships."
activerecord:
attributes:
ldap_groups/synchronized_group:
Expand Down Expand Up @@ -74,4 +77,3 @@ en:
group_text: 'Select an existing OpenProject group that members of the LDAP group shall be synchronized with'
upsale:
description: 'Take advantage of synchronised LDAP groups to manage users, change their permissions and facilitate user management across groups.'

8 changes: 8 additions & 0 deletions modules/meeting/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@

# English strings go here for Rails i18n
en:
plugin_openproject_meeting:
name: "OpenProject Meeting"
description: >-
This module adds functions to support project meetings to OpenProject. Meetings can be
scheduled selecting invitees from the same project to take part in the meeting. An agenda can
be created and sent to the invitees. After the meeting, attendees can be selected and minutes
can be created based on the agenda. Finally, the minutes can be sent to all attendees and
invitees.
activerecord:
attributes:
meeting:
Expand Down
3 changes: 3 additions & 0 deletions modules/openid_connect/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
en:
plugin_openproject_openid_connect:
name: "OpenProject OpenID Connect"
description: "Adds OmniAuth OpenID Connect strategy providers to Openproject."
logout_warning: >
You have been logged out. The contents of any form you submit may be lost.
Please [log in].
Expand Down

0 comments on commit 9d7eae1

Please sign in to comment.