Asp.Net Core Angular SPA Localization

I localized my app for the German language, which works perfectly fine if I run the following command:

ng serve --configuration=de

In my Asp.Net project I have the following line of code which is used for deployment:

<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />

How do I change that code to use the localized “de”?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Solved it by replacing it with the following:

<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --configuration=production-de" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --configuration=production-de" Condition=" '$(BuildServerSideRenderer)' == 'true' " />

This required you to have an entry for production-de inside the angular.json file under builds.

--prod is short for --configuration=production


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x