Remove duplicate map location translations

We were using the same texts twice. For the remove marker label text,
however, we were using the text defined in proposals for both proposals
and investments.

Ideally the translation keys for these texts would go in another
namespace, since they no longer refer to just proposals. However,
renaming the translation keys would mean losing the existing
translations in every language we manage through Crowdin. So we aren't
doing so.
This commit is contained in:
Javi Martín
2025-11-17 02:21:52 +01:00
parent b9adef481a
commit 8a575ae83c
6 changed files with 15 additions and 25 deletions

View File

@@ -44,12 +44,7 @@
<%= render Documents::NestedComponent.new(f) %> <%= render Documents::NestedComponent.new(f) %>
<% end %> <% end %>
<%= render MapLocations::FormFieldsComponent.new( <%= render MapLocations::FormFieldsComponent.new(f, map_location: map_location) %>
f,
map_location: map_location,
label: t("budgets.investments.form.map_location"),
help: t("budgets.investments.form.map_location_instructions")
) %>
<div> <div>
<%= f.text_field :location %> <%= f.text_field :location %>

View File

@@ -1,15 +1,23 @@
class MapLocations::FormFieldsComponent < ApplicationComponent class MapLocations::FormFieldsComponent < ApplicationComponent
attr_reader :form, :map_location, :label, :help attr_reader :form, :map_location
use_helpers :render_map use_helpers :render_map
def initialize(form, map_location:, label:, help:) def initialize(form, map_location:)
@form = form @form = form
@map_location = map_location @map_location = map_location
@label = label
@help = help
end end
def render? def render?
feature?(:map) feature?(:map)
end end
private
def label
t("proposals.form.map_location")
end
def help
t("proposals.form.map_location_instructions")
end
end end

View File

@@ -52,12 +52,7 @@
</div> </div>
<% end %> <% end %>
<%= render MapLocations::FormFieldsComponent.new( <%= render MapLocations::FormFieldsComponent.new(f, map_location: map_location) %>
f,
map_location: proposal.map_location || MapLocation.new,
label: t("proposals.form.map_location"),
help: t("proposals.form.map_location_instructions")
) %>
<div> <div>
<%= f.label :tag_list, t("proposals.form.tags_label") %> <%= f.label :tag_list, t("proposals.form.tags_label") %>

View File

@@ -80,8 +80,6 @@ en:
tags_instructions: "Tag this proposal. You can choose from proposed categories or add your own" tags_instructions: "Tag this proposal. You can choose from proposed categories or add your own"
tags_label: Tags tags_label: Tags
tags_placeholder: "Enter the tags you would like to use, separated by commas (',')" tags_placeholder: "Enter the tags you would like to use, separated by commas (',')"
map_location: "Map location"
map_location_instructions: "Navigate the map to the location and place the marker."
index: index:
title: Participatory budgeting title: Participatory budgeting
unfeasible: Unfeasible investment projects unfeasible: Unfeasible investment projects

View File

@@ -80,8 +80,6 @@ es:
tags_instructions: "Etiqueta este proyecto. Puedes elegir entre las categorías propuestas o introducir las que desees" tags_instructions: "Etiqueta este proyecto. Puedes elegir entre las categorías propuestas o introducir las que desees"
tags_label: Etiquetas tags_label: Etiquetas
tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')" tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')"
map_location: "Ubicación en el mapa"
map_location_instructions: "Navega por el mapa hasta la ubicación y coloca el marcador."
index: index:
title: Presupuestos participativos title: Presupuestos participativos
unfeasible: Proyectos de gasto no viables unfeasible: Proyectos de gasto no viables

View File

@@ -4,11 +4,7 @@ describe MapLocations::FormFieldsComponent do
let(:proposal) { Proposal.new } let(:proposal) { Proposal.new }
let(:map_location) { MapLocation.new } let(:map_location) { MapLocation.new }
let(:form) { ConsulFormBuilder.new(:proposal, proposal, ApplicationController.new.view_context, {}) } let(:form) { ConsulFormBuilder.new(:proposal, proposal, ApplicationController.new.view_context, {}) }
let(:label) { "Map location" } let(:component) { MapLocations::FormFieldsComponent.new(form, map_location: map_location) }
let(:help) { "Add a marker" }
let(:component) do
MapLocations::FormFieldsComponent.new(form, map_location: map_location, label: label, help: help)
end
it "is rendered when the map feature is enabled" do it "is rendered when the map feature is enabled" do
Setting["feature.map"] = true Setting["feature.map"] = true