You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/01/24 20:25:17 UTC

[GitHub] [nifi-fds] scottyaslan commented on a change in pull request #57: NIFI-6732 - Attempt to look up messages locale file without country d…

scottyaslan commented on a change in pull request #57:
URL: https://github.com/apache/nifi-fds/pull/57#discussion_r791123612



##########
File path: webapp/fds-bootstrap.js
##########
@@ -54,6 +54,27 @@ if (!locale || locale === 'en-us') {
         }
         platformBrowserDynamic().bootstrapModule(FdsModule, {providers: providers});
     }).fail(function () {
-        platformBrowserDynamic().bootstrapModule(FdsModule, {providers: providers});
+        // was this a country specific locale? if so, try to get the generic version of the language
+        const localeTokens = locale.split('-');
+        if (localeTokens.length === 2) {
+            translationFile = './webapp/locale/messages.' + localeTokens[0] + '.xlf';
+            $.ajax({
+                url: translationFile,
+                dataType: 'text'
+            }).done(function (translations) {
+                // add providers if translation file for locale is loaded
+                if (translations) {
+                    providers.push({provide: TRANSLATIONS, useValue: translations});
+                    providers.push({provide: TRANSLATIONS_FORMAT, useValue: 'xlf'});
+                    providers.push({provide: LOCALE_ID, useValue: localeTokens[0]});
+                }
+                platformBrowserDynamic().bootstrapModule(FdsModule, {providers: providers});
+            }).fail(function () {
+                platformBrowserDynamic().bootstrapModule(FdsModule, {providers: providers});

Review comment:
       > nifi-fds@0.3.0-SNAPSHOT eslint
   > eslint webapp platform
   
   
   /Users/jaslan/Development/nifi-fds/target/frontend-working-directory/webapp/fds-bootstrap.js
     73:16  error  Block must not be padded by blank lines  padded-blocks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org