Toparvion / analog

🔎 Flexible web-based real-time log viewer
MIT License
19 stars 5 forks source link

UI & log i18n #22

Open Toparvion opened 5 years ago

Toparvion commented 5 years ago

Because initially AnaLog was developed and used by single team only, it wasn't internationalized in any way and supported one language only (Russian). As the number of installations grows, the need arises to support other languages. Of course, English is the first one. But in case of AnaLog the i18n implies significant changes both in client (front) layer and in server (backed) layer, because the last contains a lot of log messages that should be clear for the AnaLog administrator. Except that, there are plans to modernize the front layer of AnaLog.

As a result, it doesn't seem sensible to support flexible i18n in current application state. Instead, it would be enough just to translate current messages into English and then publish the new release as is. This should satisfy both English-only speaking users as well as non-native English speaking users. And then implement the "real" i18n as a part of the modernization.

This issue assumes basic (1-to-1) translation only.

Toparvion commented 5 years ago

In order to keep current AnaLog users experience smooth, the solution has been implemented as something in between the complete i18n and the one suggested in the issue's description. There are two supported languages currently: English and Russian. And there are two scopes they are applied: web UI & certain log messages (for AnaLog administrators). Both are controlled with two new configuration settings:

spring:
  mvc:
    locale: en      # as of v0.12 supported locales are: en, ru
# Uncomment following 3 lines if the above locale is set to 'ru'    
#  resources:
#    static-locations: 
#      - 'classpath:/static/ru'  

Such an approach doesn't look simple nor flexible, doesn't support dynamic language switch (application restart needed) and produces significant code duplication but this is the simplest and fastest way so far to achieve the goal on the current stage. It is deliberately left undocumented because it will definitely be changed in subsequent releases. Instead of documenting, the behavior of the application is adapted to most users requirements by selecting English language as default.

Toparvion commented 5 years ago

@gamefundas, the translation alongside with log access restriction have been published with v0.12 release.

If you want, you can additionally check the translation, for example, by examining notification.constant.js file.

I'm leaving this issue for you to close it or to continue the conversation. Looking forward for your feedback.