I am working on rails 6 application where I'm trying to store all displayed strings in locales files. I have a Stimulus controller named countdown_controller.js:
import { Controller } from "@hotwired/stimulus";
export default class extends Controller {
static values = {
message: { type: String, default: "Deal closed!" }
}
}
en.yml:
en:
deals:
status:
closed: "Deal closed!"
I want to use I18n.t("deals.status.closed") as a value for messageValue in countdown_controller.js instead of directly writing the string. I am not sure how to do that.