[Dev Tip] Localisation with js

Beside loading resource by ajax call, load all resources,… We also can use another approach – which is more traditional by using hidden fields.

With asp.net mvc, typescript, jquery, we can play

1) A general view library

module Hydra.Views {

export class View {
public $Root: JQuery;

// You want innit because you want run construction tasks before beginning the
// behaviour of the view
Init(): void {


GetLocalisation(resourceKey: string): string {
var $localisation = $("#localisation-resource-" + resourceKey);
if ($localisation.length == 0) console.log("Couldn't find localisation hidden div for " + resourceKey + ", you can use the @Html.HiddenLocalisations(\"Key... to make localisation available");
return $localisation.val();

2) on specific view