Skip to content

Commit 974a750

Browse files
javier-godoypaodb
authored andcommitted
fix: refresh web component after updating i18n
Close #78
1 parent 7f2ea93 commit 974a750

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/com/flowingcode/addons/ycalendar/AbstractCalendarComponent.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* #%L
33
* Year Month Calendar Add-on
44
* %%
5-
* Copyright (C) 2021 - 2023 Flowing Code
5+
* Copyright (C) 2021 - 2024 Flowing Code
66
* %%
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -61,10 +61,9 @@ public void setI18n(DatePickerI18n i18n) {
6161

6262
private void setI18nWithJS() {
6363
runBeforeClientResponse(ui -> {
64+
// Merge current web component I18N settings with new I18N settings
6465
JsonObject i18nObject = (JsonObject) JsonSerializer.toJson(i18n);
65-
for (String key : i18nObject.keys()) {
66-
getElement().executeJs("this.set('i18n." + key + "', $0)", i18nObject.get(key));
67-
}
66+
getElement().executeJs("this.i18n = Object.assign({}, this.i18n, $0);", i18nObject);
6867
});
6968
}
7069

0 commit comments

Comments
 (0)