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

Pass custom function to produce the route change announcement #26

Open
tcitworld opened this issue Oct 8, 2021 · 4 comments
Open

Pass custom function to produce the route change announcement #26

tcitworld opened this issue Oct 8, 2021 · 4 comments

Comments

@tcitworld
Copy link

Currently it's just concatenating message and complement.

Vue.prototype.$announcer.set(`${msg} ${complement}`, politeness)

For i18n purposes, it would be nice to pass a function when installing the plugin that would allow to define how this works, something like:

(message) => {
  return this.$gettext('%{ message } has been loaded');
}
@ktquez
Copy link
Member

ktquez commented Oct 8, 2021

Hi @tcitworld

You can use the setComplementRoute method to update the route complement when the language changes.

@tcitworld
Copy link
Author

This method is just about changing the complement. I'm talking about totally customizing how the announcement is build.

Imagine a language where the order of the sentence would be like Loaded homepage. It wouldn't be possible with the current concatenation order.

@ajuvonen
Copy link

ajuvonen commented Dec 9, 2021

I came here to give this feature request my vote as well. There's often a case where the title of the page includes some brand naming, which can be redundant for route announces. In such case the relevant part of the route could be parsed via this kind of function.

@ux-engineer
Copy link

Here is also my feature request, somewhat similar to this. We are needing this feature for being able to properly translate the route change message with I18N setup: #27 (comment)

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

No branches or pull requests

4 participants