firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.04k stars 951 forks source link

Feature Request : Support i18n + ssr #6445

Open modernduck opened 1 year ago

modernduck commented 1 year ago

Hi I have tried some solutions to provide both i18n and server-side rendering but it seem firebase have limitation that baseHref of each locale must be "" so I can't figure way around this.

It will be nice if we can have solution for this kind of usecase.

Please submit feature requests through our support page.

jamesdaniels commented 1 year ago

Firebase uses rewrites rather than redirects for i18n, we should document this but for SSR the locale is passed as an argument to the express app factory in your server.ts.

jamesdaniels commented 11 months ago

Our test suite uses i18n FYI, see our angular.json and server.ts

douglasgc commented 10 months ago

thank you @jamesdaniels

It worked 100% for me, with angular projects, ssr, i18n and firebase hosting.

vosamoilenko commented 2 months ago

@jamesdaniels How do you change the locale? registerLocaleData doesn’t seem to work for me. I assume the server should handle the language change. I tried following this setup: https://github.com/lostium/ssr-i18n-angular17, but I'm encountering an issue where dist/<project>/browser/<locale>/index.html cannot load JS and CSS files because baseHref is set to "". I tried adjusting the path with an additional postbuild script, but that caused more problems.

After a few days of trying, I almost gave up, but then I found this issue. Honestly, it gave me some hope.