You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by rf...@apache.org on 2019/09/30 19:34:36 UTC

[nifi-fds] branch master updated: [NIFI-6560] update webapp to useHash routing strategy, request locale files as text

This is an automated email from the ASF dual-hosted git repository.

rfellows pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-fds.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e82ac7  [NIFI-6560] update webapp to useHash routing strategy, request locale files as text
8e82ac7 is described below

commit 8e82ac737901b4371f952b87f06e266990578bed
Author: Scott Aslan <sc...@gmail.com>
AuthorDate: Mon Aug 19 12:37:42 2019 -0400

    [NIFI-6560] update webapp to useHash routing strategy, request locale files as text
    
    This closes #53.
---
 webapp/components/flow-design-system/fds-demo.html |  2 +-
 webapp/fds-bootstrap.js                            |  9 +++----
 webapp/fds.routes.js                               |  2 +-
 webapp/locale/messages.es.xlf                      | 28 ++++++++++++++++++++++
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/webapp/components/flow-design-system/fds-demo.html b/webapp/components/flow-design-system/fds-demo.html
index 3966ed7..d6fd212 100644
--- a/webapp/components/flow-design-system/fds-demo.html
+++ b/webapp/components/flow-design-system/fds-demo.html
@@ -111,7 +111,7 @@ limitations under the License.
             <mat-divider></mat-divider>
             <mat-card-content>
                 <p>Tip: Use UPPERCASE text for 1-2 words, and Titlecase text for 3+ words.</p>
-                <button mat-raised-button color="primary">Primary</button>
+                <button mat-raised-button color="primary" i18n="Primary Raised Button|A raised button for the primary use of a card, dialog, or perspective.@@primary-button">Primary</button>
                 <button mat-raised-button color="accent">Accent</button>
                 <button mat-raised-button color="warn">Warn</button>
                 <button mat-raised-button color="fds-primary">FDS Primary</button>
diff --git a/webapp/fds-bootstrap.js b/webapp/fds-bootstrap.js
index eb04914..499ae7e 100644
--- a/webapp/fds-bootstrap.js
+++ b/webapp/fds-bootstrap.js
@@ -32,18 +32,19 @@ import FdsModule from 'webapp/fds.module.js';
 enableProdMode();
 
 // Get the locale id from the global
-var locale = navigator.language;
+var locale = navigator.language.toLowerCase();
 
 var providers = [];
 
 // No locale or U.S. English: no translation providers so go ahead and bootstrap the app
-if (!locale || locale === 'en-US') {
+if (!locale || locale === 'en-us') {
     platformBrowserDynamic().bootstrapModule(FdsModule, {providers: providers});
 } else { //load the translation providers and bootstrap the module
-    var translationFile = '/locale/messages.' + locale + '.xlf';
+    var translationFile = './webapp/locale/messages.' + locale + '.xlf';
 
     $.ajax({
-        url: translationFile
+        url: translationFile,
+        dataType: 'text'
     }).done(function (translations) {
         // add providers if translation file for locale is loaded
         if (translations) {
diff --git a/webapp/fds.routes.js b/webapp/fds.routes.js
index baed473..556edb9 100644
--- a/webapp/fds.routes.js
+++ b/webapp/fds.routes.js
@@ -21,6 +21,6 @@ import FdsDemo from 'webapp/components/flow-design-system/fds-demo.js';
 const FdsRoutes = RouterModule.forRoot([{
     path: '',
     component: FdsDemo
-}]);
+}], { useHash: true });
 
 export default FdsRoutes;
diff --git a/webapp/locale/messages.es.xlf b/webapp/locale/messages.es.xlf
new file mode 100644
index 0000000..509c452
--- /dev/null
+++ b/webapp/locale/messages.es.xlf
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+  <file source-language="es" datatype="plaintext" original="ng2.template">
+    <body>
+      <trans-unit id="primary-button" datatype="html">
+         <source>Primary</source>
+         <target state="new">Primario</target>
+        <note priority="1" from="description">A raised button for the primary use of a card, dialog, or perspective.</note>
+        <note priority="1" from="meaning">Primary Raised Button</note>
+       </trans-unit>
+    </body>
+  </file>
+</xliff>