Skip to content

Option to disable cascade#7

Open
mathieuGoedhart wants to merge 4 commits intomasterfrom
option_to_disable_cascade
Open

Option to disable cascade#7
mathieuGoedhart wants to merge 4 commits intomasterfrom
option_to_disable_cascade

Conversation

@mathieuGoedhart
Copy link
Copy Markdown

@mathieuGoedhart mathieuGoedhart commented Jan 21, 2025

This PR adds the option to disable the cascade functionality for the given translation

@mathieuGoedhart mathieuGoedhart self-assigned this Jan 21, 2025
@mathieuGoedhart mathieuGoedhart marked this pull request as ready for review January 21, 2025 09:30
key = scope.pop
scope = scope.map { |s| "#{s}_scope".to_sym }
options.merge!(cascade: true)
options.merge!(cascade: options.fetch(:cascade, true))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waarom is de aanpassing hier ook nodig?

Copy link
Copy Markdown
Author

@mathieuGoedhart mathieuGoedhart Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goed opgevallen. ExplicitScopeKey override de options die gezet worden in AlwaysCascade opnieuw. Dat zou de option cascade dus weer op false zetten.

Dit is waarschijnlijk zo gedaan, zodat beide workflows los aangeboden kunnen worden.

Comment thread spec/fixtures/nl.yml Outdated
context "does not cascade when cascade is set to false" do

it "returns an missing translation" do
expect(I18n.t("other", scope: "chamber_of_commerce", cascade: false)).to include("Translation missing")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Klopt het dat als de vertaling niet gevonden kan worden dan Translation missing gereturned moet worden? Of zou de key (in dit geval other) dan gereturned moeten worden?

Copy link
Copy Markdown
Author

@mathieuGoedhart mathieuGoedhart Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omdat cascade op false heb staan wordt, zoals verwacht, de other key niet dieper in de hiërarchie opgezocht.

De chamber_of_commerce scope heeft geen other en daardoor wordt geen translation gevonden:

chamber_of_commerce_scope:
    en: "Chamber of Commerce"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Als ik bijvoorbeeld I18n.t("uihefeiuwh") (key bestaat niet) in de rails console uitvoer krijg ik "Uihefeiuwh " als output i.p.v. Translation missing. Klopt het dan dat je Translation missing krijgt? Of zou je dus de key (Uihefeiuwh) gereturned moeten krijgen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants