Comparison of local and internal localization strategies

I am developing an application based on Sails JS interfaces and Web and Mobile interfaces. My plans for front-end frameworks are as follows:

  • Web fronend - AngularJS + Bootstrap
  • Mobile interface - AngularJS + Ionic with a later port from Apache Cordova

As for the brief explanation above, I have to add a localization function to the application. And here my question arises - since both Sails JS and AngularJS support localization, which one is suitable for my project?

Theoretically, I can have:

  • full localization - I will use the built-in features of Sails JS and put all localized resources as json files on the backend
  • full interface localization - I could add add-ons and localize AngularJS interfaces on the interface or
  • mixing of internal and local localizations.

I would be grateful if people with extensive experience discussed this topic in detail, considering the architecture of the applications and giving me some enlightenment about the possible pros and cons of the available options.

+10
angularjs twitter-bootstrap cordova ionic-framework
source share
2 answers

I prefer something like 1.

We are working on a rather huge Angular.js SPA application that also supports i18n. First we used full localization (if I remember this correctly)

But when the application got bigger and bigger, it became difficult to manage i18n files by uploading them to a page (and you only need to download the necessary lines, because the i18n file is huge!), Etc.

In addition, the user rarely changes the language, he does not need to be dynamic, fast, two-way or other. This is normal if we reload the entire application.

So why did we think? We do not need i18n in the interface. We need i18n in our "application". Then I wrote a build system on node.js, basically it is a preprocessor that parses all the *.html and *.js files that we have, extracts the lines from them, looks through them using the i18n file, places the localized string and creates copies files per word count.

Thus, we create n applications instead of 1, all software-generated, each in a different language.

It works very well. When the user changes the language, we reload the page and turn on another localized set of files, and the language changes!

Example html file source:

 <header>@message("string.to.be.localized.1"i "{{name}}")</header> 

Example js file:

 angular.module("app", []) .directive("x", function(i18n) { return { templateUrl: "@HTML/templates/a.html", link: function() { console.log(i18n("string.in.js", "Umut")); } } }) 

After compilation:

source.en.html

 <header>Hello {{name}}</header> 

source.tr.html

 <header>Merhaba {{name}}</header> 

sample.en.js

 angular.module("app", []) .directive("x", function(i18n) { return { templateUrl: "/templates/a.en.html", link: function() { console.log("Hello {0}", "Umut")); } } }) 

sample.tr.js

 angular.module("app", []) .directive("x", function(i18n) { return { templateUrl: "/templates/a.tr.html", link: function() { console.log("Merhaba {0}", "Umut")); } } }) 
+4
source share

I prefer front-end localization. On the server side, you can throw any exception that contains an exception code and explanations in English - this is for developers. In the external interface, you can use each JSON file (or another) for each localization language based on codes that you received from the internal interface or based on the architecture logic of your external interface.

Why I find interface localization better - because the interface is closer to the user than the server, and you can provide him with a package of your files with one localization file for his language. Since an external application can call several internal operations in one or even of several services (both internal and external), message localization is redundant, since the user must receive any message that is clear and loyal to the user (but not any). for example, "it is impossible to insert data into the table" or "the external server does not respond") - you ignore this message and provide your own. Moreover, today the back-end is written to communicate with many other services (not people), and localization is redundant here, since every developer understands English.

+1
source share

All Articles