Update index.html to change language from German to English and modify instructional text for clarity and accessibility. #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Internationalization (i18n) Support with Comprehensive Test Suite
Overview
This PR adds full internationalization (i18n) support to the MNIST MLP Inference Visualization application, enabling users to switch between English and German languages. The implementation includes a robust i18n module, translation files, UI integration, and a comprehensive test suite with 65+ tests.
Features
🌍 Internationalization Module (
assets/i18n.js)t("aria.loadRandom", { digit: 5 }))data-i18n- Text content translationdata-i18n-html- HTML content translationdata-i18n-aria-label- ARIA label translationlangattribute updates and translatable ARIA labelslanguageChangedevent for components that need to react to language changes📝 Translation Files
assets/i18n/en.json): Complete English translations for all UI elementsassets/i18n/de.json): Complete German translations for all UI elements🎨 UI Integration
data-i18nattributest()function throughoutmain.jsTesting
Comprehensive Test Suite (
test-i18n.js)A robust Node.js-based test suite with 65 tests across 8 test suites:
Translation File Structure and Completeness (7 tests)
i18n.js Module Code Analysis (18 tests)
HTML Integration (14 tests)
data-i18nattributes are used correctlyJavaScript Integration (9 tests)
t()function usage inmain.jsTranslation Key Coverage (3 tests)
Code Quality and Best Practices (5 tests)
Edge Cases and Error Handling (5 tests)
Accessibility and Internationalization (4 tests)
langattribute updatesBrowser Test Suite (
test-i18n-browser.html)A browser-based test suite that tests runtime behavior:
Unified Test Runner (
test.js)A convenient unified test runner that:
Test Documentation (
TEST-README.md)Comprehensive documentation covering:
Usage
Running Tests
Using Translations in Code
Adding New Translations
assets/i18n/en.jsonandassets/i18n/de.jsondata-i18n="key.path"in HTML ort("key.path")in JavaScriptnode test.jsFiles Changed
New Files
assets/i18n.js- i18n module implementationassets/i18n/en.json- English translationsassets/i18n/de.json- German translationstest-i18n.js- Comprehensive test suite (65 tests)test-i18n-browser.html- Browser-based test suitetest.js- Unified test runnerTEST-README.md- Test documentationModified Files
index.html- Added i18n script, language toggle button, anddata-i18nattributesassets/main.js- Integratedt()function for dynamic translationsassets/main.css- Styling updates (if any)Testing Results
All tests pass:
Benefits
Future Enhancements
Checklist