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

ilgrosso pushed a commit to branch 2_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_0_X by this push:
     new 775952d  [SYNCOPE-1560] Setting FileInputConfig's language after 
SyncopeConsoleSession
775952d is described below

commit 775952d6718c345a96e46183cd1a68868a57cf8b
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Tue May 12 11:23:45 2020 +0200

    [SYNCOPE-1560] Setting FileInputConfig's language after 
SyncopeConsoleSession
---
 .../wicket/markup/html/form/BinaryFieldPanel.java  | 23 +++++++++++-----------
 .../console/SyncopeConsoleApplication.properties   |  1 +
 .../SyncopeConsoleApplication_it.properties        |  1 +
 .../markup/html/form/BinaryFieldPanel.properties   | 17 ----------------
 .../html/form/BinaryFieldPanel_ja.properties       | 17 ----------------
 5 files changed, 13 insertions(+), 46 deletions(-)

diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
index 87e6b8a..1f7a4c7 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
@@ -175,12 +175,11 @@ public class BinaryFieldPanel extends FieldPanel<String> {
         downloadLink.setOutputMarkupId(true);
         uploadForm.add(downloadLink);
 
-        FileInputConfig config = new FileInputConfig();
-        config.showUpload(false);
-        config.showRemove(false);
-        config.showPreview(false);
+        FileInputConfig config = new FileInputConfig().
+        showUpload(false).showRemove(false).showPreview(false).
+        withLocale(SyncopeConsoleSession.get().getLocale().getLanguage());
 
-        fileUpload = new BootstrapFileInputField("fileUpload", new 
ListModel<>(new ArrayList<FileUpload>()), config);
+        fileUpload = new BootstrapFileInputField("fileUpload", new 
ListModel<>(new ArrayList<>()), config);
         fileUpload.setOutputMarkupId(true);
 
         fileUpload.add(new AjaxFormSubmitBehavior(Constants.ON_CHANGE) {
@@ -189,24 +188,24 @@ public class BinaryFieldPanel extends FieldPanel<String> {
 
             @Override
             protected void onSubmit(final AjaxRequestTarget target) {
-                final FileUpload uploadedFile = fileUpload.getFileUpload();
+                FileUpload uploadedFile = fileUpload.getFileUpload();
                 if (uploadedFile != null) {
                     if (maxUploadSize != null && uploadedFile.getSize() > 
maxUploadSize.bytes()) {
                         // SYNCOPE-1213 manage directly max upload file size 
(if set in properties file)
-                        
SyncopeConsoleSession.get().error(getString("tooLargeFile")
-                                .replace("${maxUploadSizeB}", 
String.valueOf(maxUploadSize.bytes()))
-                                .replace("${maxUploadSizeMB}", 
String.valueOf(maxUploadSize.bytes() / 1000000L)));
+                        
SyncopeConsoleSession.get().error(getString("tooLargeFile").
+                                replace("${maxUploadSizeB}", 
String.valueOf(maxUploadSize.bytes())).
+                                replace("${maxUploadSizeMB}", 
String.valueOf(maxUploadSize.bytes() / 1000000L)));
                         ((BasePage) 
getPageReference().getPage()).getNotificationPanel().refresh(target);
                     } else {
-                        final byte[] uploadedBytes = uploadedFile.getBytes();
-                        final String uploaded = new 
String(Base64.encodeBase64(uploadedBytes), StandardCharsets.UTF_8);
+                        byte[] uploadedBytes = uploadedFile.getBytes();
+                        String uploaded = new 
String(Base64.encodeBase64(uploadedBytes), StandardCharsets.UTF_8);
                         field.setModelObject(uploaded);
                         target.add(field);
 
                         if (previewer == null) {
                             container.addOrReplace(emptyFragment);
                         } else {
-                            final Component panelPreview = 
previewer.preview(uploadedBytes);
+                            Component panelPreview = 
previewer.preview(uploadedBytes);
                             changePreviewer(panelPreview);
                             fileUpload.setModelObject(null);
                             uploadForm.addOrReplace(fileUpload);
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
index 064f6f1..ceeeff9 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
@@ -75,3 +75,4 @@ administration=Administration
 timeout=Operation is taking too long: it will be executed in background. 
Please check later for the result (errors won't be triggered).
 before=Before
 after=After
+tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB} 
bytes (${maxUploadSizeMB} MB).
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
index dca64f0..5137243 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
@@ -75,3 +75,4 @@ administration=Amministrazione
 timeout=L'operazione sta durando troppo: sar\u00e0 eseguita in background. 
Verifica il risultato pi\u00f9 tardi (gli errori non saranno notificati).
 before=Prima
 after=Dopo
+tooLargeFile=File troppo grande, la dimensione massima ammessa \\u00e8 
${maxUploadSizeB} bytes (${maxUploadSizeMB} MB).
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.properties
deleted file mode 100644
index 6db49af..0000000
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB} 
bytes (${maxUploadSizeMB} MB).
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel_ja.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel_ja.properties
deleted file mode 100644
index f82cd54..0000000
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel_ja.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-tooLargeFile=\u30d5\u30a1\u30a4\u30eb\u304c\u5927\u304d\u3059\u304e\u307e\u3059\u3002\u6700\u5927\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u30b5\u30a4\u30ba\u306f
 ${maxUploadSizeB} \u30d0\u30a4\u30c8 (${maxUploadSizeMB} MB) \u3067\u3059\u3002

Reply via email to