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

Trigger localization based on URL? #80

Open
vilav opened this issue Jul 14, 2016 · 3 comments
Open

Trigger localization based on URL? #80

vilav opened this issue Jul 14, 2016 · 3 comments

Comments

@vilav
Copy link

vilav commented Jul 14, 2016

Hi there

The plugin looks amazing. Is there a way to trigger a string's localization based on the URL of the page?

For instance, on website.com/fr, a string like "Hello" would be "Bonjour"
Similarly on website.com/es, the string could be "Hola"?

Any tips on how to accomplish this?

@alexwebgr
Copy link

hi vilav

relying on the url for your persisting your language sounds kinda fragile to me
depending how is your website setup i.e. how are you going to parse and populate the url
implementations vary significantly but a high level flow would like this

have links that point to each language
click the link
read the parameter from url assign it to the plugin

would you be willing to consider a session based language switcher
#77

perhaps you could extend it to read the params from the href attribute, where the full exists, instead of the data-lang attribute

regards
alex

@vilav
Copy link
Author

vilav commented Jul 14, 2016

Do you have any example code how I can structure that? The URL will be setup in a way that the suffix of language (de/fr etc.) is always persistent in that piece of content. the URL could be a simpler trigger to toggle language content making it easy to integrate with static and cms-based sites, do you think so?

@alexwebgr
Copy link

alexwebgr commented Jul 14, 2016

the github editor ate my link !
click on number 77 in my previous post

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

2 participants