make example buttons refresh on locale change

This commit is contained in:
ucrhh 2021-03-13 12:26:23 +01:00
parent dc60c58011
commit 3dd79320be
3 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@
}
#headingLayout {
min-height: 107px;
width: 100%;
display: flex;
position: relative;

View File

@ -39,6 +39,7 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
private final Select<Locale> languageSelect;
private final ItemLabelGenerator<Locale> renderer;
private final Paragraph typicalcInfo;
private final Button exampleButton;
/**
* Create a new HelpDialog.
@ -61,6 +62,7 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
headingLayout.add(heading, languageSelect, closeIcon);
exampleButton = InputBar.createExampleButton();
VerticalLayout contentLayout = new VerticalLayout();
Accordion content = createHelpContent();
content.setId(ACCORDION_ID);
@ -83,7 +85,7 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
acc.add(new HelpContentField("root.shortcuts", "root.helpShortcuts"));
acc.add(new HelpContentField("root.drawer", "root.helpDrawer"));
acc.add(new HelpContentField("",
InputBar.createExampleButton(), "root.helpExample"));
exampleButton, "root.helpExample"));
acc.add(new HelpContentField("root.firstStepButton",
new Button(new Icon(VaadinIcon.ANGLE_DOUBLE_LEFT)), "root.helpFirstStepButton"));
acc.add(new HelpContentField("root.previousStepButton",
@ -99,6 +101,7 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
@Override
public void localeChange(LocaleChangeEvent event) {
exampleButton.setText(getTranslation("root.exampleButton"));
heading.setText(getTranslation("root.operatingHelp"));
languageSelect.setLabel(getTranslation("root.selectLanguage"));
languageSelect.setTextRenderer(renderer);

View File

@ -138,6 +138,7 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
@Override
public void localeChange(LocaleChangeEvent event) {
inputField.setPlaceholder(getTranslation("root.inputFieldPlaceholder"));
exampleButton.setText(getTranslation("root.exampleButton"));
inferTypeButton.setText(getTranslation("root.typeInfer"));
typeAssumptions.setText(getTranslation("root.typeAssumptions"));
infoIcon.getElement().setAttribute("title", getTranslation("root.inputSyntax"));