Skip to content

Commit 7b8ba7e

Browse files
committed
feat(demo): localize visible MainDemo UI
1 parent ece032b commit 7b8ba7e

15 files changed

Lines changed: 1318 additions & 211 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ Changelog categories for `Unreleased` and new release sections (in order, includ
1616

1717
## Unreleased
1818

19+
## v0.7.2 - 2026-04-01
20+
21+
### UI and Interaction
22+
- ✅ Localized the visible MainDemo experience end-to-end so runtime locale changes now immediately update demo chrome, settings, dialogs, dock-node titles, and demo content instead of only framework context menus.
23+
24+
### Tests
25+
- ✅ Added regression coverage for immediately visible demo locale switching, localized demo-node title/content updates, and complete non-blank `EN`/`DE`/`FR` demo text bundles.
26+
1927
### Build and Tooling
2028
- ✅ Updated the GitHub Pages docs workflow to fetch full Git history and tags for `gradle-jgitver`, and added a JavaDoc version guard that fails if fallback version `0.0.0-0` is resolved.
2129

DONE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SnapFX Framework - Completed Milestones
22

3-
**Last Updated**: 2026-03-17
3+
**Last Updated**: 2026-04-01
44

55
## Product Baseline
66

@@ -9,7 +9,7 @@
99
-**Sidebar Interaction Scope Delivered**: Strip DnD baseline, framework/sidebar move/restore/pin actions, resize + persistence, and visibility modes
1010
-**Persistence and Recovery Delivered**: Save/load pipeline with typed load errors and unknown-node fallback recovery
1111
-**Theme Runtime Delivered**: Default stylesheet auto-apply plus runtime theme switching (`Light` / `Dark`)
12-
-**Localization Runtime Delivered**: Built-in `EN`/`DE` locale support, runtime locale/provider API, provider fallback chain, and ResourceBundle adapter extensibility
12+
-**Localization Runtime Delivered**: Built-in `EN`/`DE` locale support, runtime locale/provider API, provider fallback chain, ResourceBundle adapter extensibility, and a fully localized MainDemo showcase with demo-specific `EN`/`DE`/`FR` content
1313

1414
## Engineering Baseline
1515

STATUS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Project Status
22

3-
**Last Updated**: 2026-03-17
3+
**Last Updated**: 2026-04-01
44

55
## Current Snapshot
66

@@ -17,7 +17,7 @@
1717
-**Floating Windows**: Detach/attach, drag+resize snapping, persistence, and always-on-top behavior
1818
-**Side Bars**: Current scope completed (DnD strip baseline, built-in move/restore/pin actions, resize + persistence, visibility modes)
1919
-**Theming**: Default stylesheet auto-apply plus runtime theme switching (`Light` / `Dark`)
20-
-**Localization Runtime**: Built-in `EN`/`DE` locale switching, provider extension API, and FX-thread mutation enforcement are in place
20+
-**Localization Runtime**: Built-in `EN`/`DE` locale switching, provider extension API, FX-thread mutation enforcement, and a fully localized MainDemo showcase (`EN` / `DE` / `FR`) are in place
2121
-**Manual Verification**: MainDemo settings keep API-to-settings parity for framework features
2222

2323
## Open Items

docs/images/main-demo.png

126 Bytes
Loading

snapfx-demo/src/main/java/org/snapfx/demo/MainDemo.java

Lines changed: 265 additions & 101 deletions
Large diffs are not rendered by default.

snapfx-demo/src/main/java/org/snapfx/demo/dialog/AboutDialog.java

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.snapfx.BuildInfo;
44
import org.snapfx.demo.MainDemo;
5+
import org.snapfx.demo.i18n.DemoLocalizationService;
56
import javafx.animation.FadeTransition;
67
import javafx.animation.Interpolator;
78
import javafx.animation.ParallelTransition;
@@ -54,20 +55,32 @@ private AboutDialog() {
5455
* @param linkOpener callback used for opening external links
5556
*/
5657
public static void show(Window owner, Consumer<String> linkOpener) {
58+
show(owner, linkOpener, new DemoLocalizationService(AboutDialog.class.getModule()));
59+
}
60+
61+
/**
62+
* Shows the About dialog.
63+
*
64+
* @param owner owner window for modality; can be {@code null}
65+
* @param linkOpener callback used for opening external links
66+
* @param localizationService localization service used for demo strings
67+
*/
68+
public static void show(Window owner, Consumer<String> linkOpener, DemoLocalizationService localizationService) {
5769
Objects.requireNonNull(linkOpener, "linkOpener");
70+
Objects.requireNonNull(localizationService, "localizationService");
5871

5972
Alert alert = new Alert(Alert.AlertType.INFORMATION);
6073
if (owner != null) {
6174
alert.initOwner(owner);
6275
}
6376

64-
alert.setTitle("About SnapFX");
77+
alert.setTitle(localizationService.text("demo.about.title"));
6578
alert.setHeaderText(null);
6679

6780
DialogPane dialogPane = alert.getDialogPane();
6881
dialogPane.setGraphic(null);
6982
dialogPane.setPrefWidth(620);
70-
dialogPane.setContent(createContent(linkOpener));
83+
dialogPane.setContent(createContent(linkOpener, localizationService));
7184

7285
applyDialogIcon(alert);
7386
alert.showAndWait();
@@ -93,27 +106,28 @@ static String getYusukeLicenseUrl() {
93106
return YUSUKE_LICENSE_URL;
94107
}
95108

96-
private static VBox createContent(Consumer<String> linkOpener) {
97-
Label titleLabel = new Label("SnapFX Docking Framework");
109+
private static VBox createContent(Consumer<String> linkOpener, DemoLocalizationService localizationService) {
110+
Label titleLabel = new Label();
111+
localizationService.bind(titleLabel, "demo.about.header.title");
98112
titleLabel.setStyle(MainDemo.FX_FONT_WEIGHT_BOLD + "-fx-font-size: 18px;");
99113

100-
Label versionLabel = new Label("Version " + BuildInfo.getVersion());
114+
Label versionLabel = new Label();
115+
localizationService.bind(versionLabel, "demo.about.version", BuildInfo.getVersion());
101116
versionLabel.setStyle(MainDemo.FX_FONT_WEIGHT_BOLD);
102117

103-
Label descriptionLabel = new Label(
104-
"A high-performance, lightweight JavaFX docking framework\n" +
105-
"designed for professional IDE-like applications."
106-
);
118+
Label descriptionLabel = new Label();
119+
localizationService.bind(descriptionLabel, "demo.about.description");
107120
descriptionLabel.setWrapText(true);
108121

109-
Label easterEggLabel = new Label("Easter egg unlocked: docking energy is now at 100%.");
122+
Label easterEggLabel = new Label();
123+
localizationService.bind(easterEggLabel, "demo.about.easterEgg");
110124
easterEggLabel.setWrapText(true);
111125
easterEggLabel.setVisible(false);
112126
easterEggLabel.setManaged(false);
113127
easterEggLabel.setOpacity(0.0);
114128
easterEggLabel.setStyle("-fx-text-fill: #2873b8; -fx-font-style: italic;");
115129

116-
Node logoNode = createLogoNode();
130+
Node logoNode = createLogoNode(localizationService);
117131
if (logoNode instanceof ImageView logoView) {
118132
installEasterEggAnimation(logoView, easterEggLabel);
119133
}
@@ -125,20 +139,25 @@ private static VBox createContent(Consumer<String> linkOpener) {
125139
HBox header = new HBox(16, logoNode, headerText);
126140
header.setAlignment(Pos.CENTER_LEFT);
127141

128-
Label licenseTitle = new Label("Icon Credits");
142+
Label licenseTitle = new Label();
143+
localizationService.bind(licenseTitle, "demo.about.iconCredits");
129144
licenseTitle.setStyle(MainDemo.FX_FONT_WEIGHT_BOLD);
130145

131146
FlowPane yusukeCredits = new FlowPane(5, 5);
147+
Label someIconsByLabel = new Label();
148+
localizationService.bind(someIconsByLabel, "demo.about.someIconsBy");
149+
Label licensedUnderLabel = new Label();
150+
localizationService.bind(licensedUnderLabel, "demo.about.licensedUnder");
132151
yusukeCredits.getChildren().addAll(
133-
new Label("Some icons by"),
152+
someIconsByLabel,
134153
createHyperlink("Yusuke Kamiyamane", YUSUKE_AUTHOR_URL, linkOpener),
135-
new Label("licensed under"),
154+
licensedUnderLabel,
136155
createHyperlink("Creative Commons Attribution 3.0", YUSUKE_LICENSE_URL, linkOpener),
137156
new Label(".")
138157
);
139158

140159
Hyperlink flaticonCredits = createHyperlink(
141-
"Logout icons created by Pixel perfect - Flaticon",
160+
localizationService.text("demo.about.flaticonCredit"),
142161
FLATICON_CREDIT_URL,
143162
linkOpener
144163
);
@@ -156,13 +175,13 @@ private static VBox createContent(Consumer<String> linkOpener) {
156175
return content;
157176
}
158177

159-
private static Node createLogoNode() {
178+
private static Node createLogoNode(DemoLocalizationService localizationService) {
160179
ImageView logoView = createImageView(CONTENT_LOGO_RESOURCE, 110);
161180
if (logoView != null) {
162181
return logoView;
163182
}
164183

165-
Label fallback = new Label("SnapFX");
184+
Label fallback = new Label(localizationService.text("demo.about.logoFallback"));
166185
fallback.setStyle(MainDemo.FX_FONT_WEIGHT_BOLD + "-fx-font-size: 28px;");
167186
return fallback;
168187
}

0 commit comments

Comments
 (0)