Open areijngoudt opened 6 years ago
ng xi18n
operates over components of your Angular application, but index.html
is not part of it actually. It's not a component template.
I don't think this is functionality we can provide but @ocombe might know more.
wel, the entry and name index.html are in the .angular-cli.json. Also, the cli can inject the base href using the --base-href switch
it will be possible as part of universal (it's on the roadmap)
If I can't use server-side rendering, is there a plan to inject translated string in index.html
or other static file ?
if parsing the index.html
would be possible, we could also set the right language attribute in the HTML-tag.
What's the status on this? I'm trying to set up locale-specific index.html
to change some tags specific to the locale, like the title
, the HTML lang
attribute, canonical link, and others, but can't rely on the i18n translation.
Was trying to make multiple index.html
files, 1 per locale, but when I run with --localize
flag it ignores the angular.json
config about which index.html
to use.
Looks like this, building with --configuration=es-CO
works, but using --localize
to build all locales at once doesn't work:
I filed a bug for this: #17684
index.html
in the localization process would be a better solution than providing a way to compile multiple configurations
at once, or providing the i18n a way to configure the index.html
to use for each locale.For now, working around it by creating a configuration
for each locale and building all of them through gulp script in series.
Has there been any updates regarding this issue? It would be a great improvement being able to translate the index.html
Yes, I also have such wish in a project on Angular 11. Is it exists a solving way?
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
We need this feature to specify i18n og-meta tags in index.html. Use case would be a customer application where customers must always log in BUT can receive e.g. an invoice link using WhatsApp that goes to the page that displays the invoice for the user. Company would send a link using WhatsApp and user would
A very basic use case in 2022 and we of course need this to be language specific to have a nice description, title and icon in WhatsApp
Angular should have a feature for this use case in 2022:
<meta property="og:description" i18n-content="@@og.description" content="Welcome to the customer application of AweSomeCompany. " />
As others have stated: seems like the Angular CLI could easily process the index.html and put the correct value in there as its a valid uses case using i18n. Is there an Angular way, an official Angular workaround way of doing this or is this use case not going to be recognised?
Adding @AndrewKushnir as he seems to be in charge of i18n at Angular.
Thanks.
Would also like to see this so we can translate our noscript
message.
Can this feature request be re-evaluated?
For us this would be really useful so we can set different script url's for different languages. Currently there is no proper way of doing this.
I also just stumbled over this and would greatly appreciate a fix.
I think the i18n configuration of the angular.json
should be extended. Consider the following use-case:
We're building a website which is targeted for a specific country. It has some features that only make sense for people who can speak the language of that country. So we'd like to drop some functionality (at compile-time!) from the other localized versions of the app. This would be possible with an environment
-like setup (with file replacements) and use a compile-time constant to conditionally import that module.
However, as it was discussed before, the current localization process is not designed in a way that it can re-build the app for different locales. (Technically this issue is similar to https://github.com/angular/angular-cli/issues/17684)
We've tried the configuration-way: instead of providing the --localize
flag in the CLI, we created multiple configurations that set the appropriate locale
. However, when the build starts, the output directory is cleared which makes this approach uncomfortable (the built version for locale A must be copied somewhere else before the build is started for locale B).
Is there any plan to extend the i18n system?
We need this feature to specify i18n og-meta tags in index.html. Use case would be a customer application where customers must always log in BUT can receive e.g. an invoice link using WhatsApp that goes to the page that displays the invoice for the user. Company would send a link using WhatsApp and user would
- click on the link in WhatsApp
- log in (if not already)
- Web application opens the page and users can see the invoice
A very basic use case in 2022 and we of course need this to be language specific to have a nice description, title and icon in WhatsApp
Angular should have a feature for this use case in 2022:
<meta property="og:description" i18n-content="@@og.description" content="Welcome to the customer application of AweSomeCompany. " />
As others have stated: seems like the Angular CLI could easily process the index.html and put the correct value in there as its a valid uses case using i18n. Is there an Angular way, an official Angular workaround way of doing this or is this use case not going to be recognised?
Adding @AndrewKushnir as he seems to be in charge of i18n at Angular.
Thanks.
For our use cases, we ended up using Angular Universal and prerender certain pages. It’s not ideal as we now no longer are able to deploy on Tomcat but need to use Node Express server with accompanied environment + custom setup for locale specific config. Seems like there is still a lot of work to do in documenting Angular Universal combined with localization + pre-rendering + Node Express server setup as it’s too painful and no official documentation available. For basic usage without Angular Universal, index.html should just include i18n.
Versions
Repro steps
please wait...
Observed behavior
Desired behavior