Using ASP Localization with Angular2 +

You already have a ASP.Net project with Localization all set up and localized. Sure, you could convert the resx files and use Internationalization (i18n) built into Angular 2+. Well, another option is to keep the whole setup the same, and still let the server-side handle everything. This small tutorial won’t go over date and time, only string localization. Keep in mind you will not be loading all languages, rather only the one the browser is set to. So if for reasons you wanted to load all languages, for example, no refresh language change, this approach will need some modifications.

The prereqs are that you already have a project set up with your localization file already being used. An example is on any cshtml page, you should simply be able to localize using LocalizationProjectName.The_Key. Moving on, you also have an angular 2+ project already set up. If you don’t, you could use a seed project to test this out.

Read More

Angular 2 CLI – Extract Hash Value

Hey, all! In this post, I’m just going to quickly show you how you could extract the hash that’s generated using angular 2’s CLI to build with the any of the productions build flags.

ng build --target=production --environment=prod
ng build --prod --env=prod
ng build --prod

For starters, why does cli add this random string in the generated files? The simple answer is what we call cache-busting. Leaving what cache is, and what it means to cache-bust for you to research on your own. So it’s great and all, but even if you’re using the cli, you’re not necessarily using its index.html file for anything. You might have your own way of inserting these generated files into your application. Which also means you’ll need to know the file name.

Read More