我正在尝试做一些非常简单的事情。
场景如下:我有一个与启用 pushstate 的浏览器配合得很好的整个站点。该网站的工作基于语言是“实际页面”,例如:
/en/whatever/etc = index.en.php with with english headers and encoding & tweaks
/ar/whatever/etc = index.ar.php with with arabic headers and encoding & tweaks
/ru/whatever/etc = index.ru.php with with russian headers and encoding & tweaks
正如我提到的,它真的很漂亮,并且可以很好地与 pushstate 配合使用。问题是当我尝试将相同的路由器代码与散列选项一起使用时。
Backbone 的路由器似乎想要这样做:
/#/en/whatever/etc = bad because it's not based correctly
/#/ar/whatever/etc = and so on
我想要它做的是:
/en/#whatever/etc
/ar/#whatever/etc
/ru/#whatever/etc
..and so on
or even:
/en/#/whatever/etc
/ar/#/whatever/etc
/ru/#/whatever/etc
..and so on
但是如果不调整骨干源来实现这一点,我就找不到方法。我有点反对改变backbone.js,除非我真的必须因为未来的因素而改变。
有人有什么想法吗?