Comments (14)
i looked over this together with dan. i agree that in the Multilang bundle we seem to partially duplicate the functionality of what he is doing. however, we think there is a fundamental philosophy clash between lunetics and what we think is right:
unless we misunderstood completely, the bundle does not use the _locale of the url but thinks that all languages are served under the exact same logic. i have seen this idea once or twice before from semantic web purists (the url is for the entity, the language is just different representation of content, language is negotiation). i think its wrong and it breaks with search engines and so on.
we could try to talk with the author and see if we understood correctly and if he would agree to make his bundle work with both situations though. and if not we could borrow some ideas from that bundle.
from cmf-sandbox.
i agree
from cmf-sandbox.
i sent the author an email
from cmf-sandbox.
For my POV, it will also need priorities preferences for the bundle itself. For e.g : You have an url like http://en.myapp.com/home/hello that you visit with a browser installed in French, which one to choose first or let the developer choose the one to choose in priority? it's a lot of choose....
from cmf-sandbox.
@Kwattro we should respect the browser supplied preferences. if none of that matches, we can just fallback on a default language. when loading content, we have another fallback order in phpcr-odm and there we could actually pimp a bit by reordering according to the browser settings.
i had a good chat with @lunetics yesterday. it turns out that the bundle for now just does not care about the _locale in the url, but there is no design decision to not have it. the bundle just does not assume any url scheme. he would be interested in pull requests to make the bundle more flexible. i think we want:
- allow to inject a service into the twig extension that renders the translation urls. that way we can directly link to the right translated content if we can determine it. or we can keep his redirection controller but add a url parameter to it, to still have the language choice cookie feature for the next visit.
- in our multilanguage route controller we no longer need to determine the locale but can get it from localeIdentified or rather use the service of LocaleBundle to determine the right language from our current choices.
anybody motivated to take this on? if i have to do it, it could take a while until i get to it...
from cmf-sandbox.
Yes it sounds logic but I was more thinking about it this morning as we actually need this implementation for another project.
As stated in the LocaleBundle, the User can change language manually, so the app cookie will contain the UserPrefered language that can be different from the browser language, so it is why I think it could be great to allow priorities in the bundle config 1->cookie 2->browser 3->url 4->fallback for other implementations of the bundle.
I set 1->cookie because for me this is part of USER preferences.
from cmf-sandbox.
Adding some kind of Priority sounds like a good idea (e.g. when you want to add GEOIP as fallback). Also would be good to make it userconfigurable
from cmf-sandbox.
Ok, I need to go inside this implementation in the next 15 days. In the first look, I intend to add a listener on the kernel.request event and do the logic there, priorities, check if cookie exist and move the current logic of the bundle in a BrowserLocaleDetector class that will be called in the listener.
Do you have better ideas or other requirements before I start ? Is somebody else already busy with it ?
One thing where I will need some light is for the cached pages that does not have a locale specified in the url ? The call wil not be done to verify the browser preference with the current implementation of the LocaleBundle ?
Regards,
from cmf-sandbox.
@Kwattro i think the ideal approach would be to refactor the lunetics LocaleBundle to have the priorities and discuss with lunetics about other improvments. and test the interaction when the routing is using _locale (who wins, what should win?)
and then remove the reinventing-the-wheel part i did in the cmf multilang bundle and just keep what is necessary to leverage LocaleBundle
i think having different languages under exactly the same url is very wrong (search engines and bookmarks come to my mind). but it could be ok to have translated urls without a locale if somebody really wants to. like www.example.com/firma and www.example.com/company (note that even in that situation we could have a _locale in the route information)
i am not aware of anybody working on this for the cmf atm, so please go ahead :-) i will try to comment and look at pull requests and such. for design decisions or other input, or technical help as well, you are of course also invited to write to the symfony-cmf google mailinglist.
from cmf-sandbox.
@dbu Ok I will make a PR in the upcoming days and inform it here or in the mailing list.
Regards,
from cmf-sandbox.
from cmf-sandbox.
Hello,
I've made some commits against the PR, I've also post in the ML my questions.
Good evening,
Regards,
from cmf-sandbox.
@lsmith77 integrated the bundle into the symfony cmf standard edition. it would be ready to integrate it into the sandbox as well and clean up our homegrown language stuff.
from cmf-sandbox.
from cmf-sandbox.
Related Issues (20)
- PHPCRException: The Id is immutable HOT 3
- Breadcrumb stopped working HOT 1
- Sandbox offline HOT 3
- CMF Sandbox host: "No space left on device" HOT 1
- Session-Error on live sandbox HOT 1
- Interface language vs content language switch is confusing HOT 2
- Segmentation fault on jackrabit build
- Some missing translations HOT 3
- Problem loading fixtures HOT 3
- Adjust Directory Structure HOT 1
- Use Enviroment Variables instead of parameters.yml HOT 2
- Introduce Unified Web Controller
- Introduce Make File
- Remove current vagrant box and replace by nix environment HOT 1
- Live Demo not working HOT 2
- Can't access admin backend on sandbox demo
- Exception on admin list pages HOT 1
- Admin panel content edit fails (FatalErrorException) HOT 3
- CMF Sandbox v 2.1: Load doctrine fixtures cause Exception HOT 1
- Doesn't work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmf-sandbox.