byteSlayer byteSlayer - 1 year ago 87
HTML Question

Managing strings and constants in a web app

We have a pretty large React-Redux based web app. In the app - and specifically in the UI - we have a lot of strings and constants (URL, name of app, button labels etc...). What's a recommended way of managing those strings and constants, considering the following requirements:

  1. We have a lot of on premise installations and we want to be able to easily change things like system name / link url / button names.

  2. We want to easily be able to go over the language in the UI and modify it.

  3. We want to be able to localize the app in multiple languages.

The obvious method is to have the strings scattered all over and utilize find-and-replace, but we are wondering if there is a better way to centralize string management.

Answer Source

You could route your scripts though a configuration file so that you have all of these in one place to modify them. This is common in most CMS systems, i.e. Wordpress, Opencart.

Google the term i18n and you should be able to find a heap of information on internationalisation.

Here is a simple class that I saw which might make it easier to understand how this might work out for you in your project.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download