Repository navigation
Add comprehensive locale testing and improve translation coverage - #28
Merged
Merged
Conversation
…nd oc.php Unit tests check the locale files (valid, no duplicate keys, UTF-8, date formats, all texts of the code in en.php); integration tests run the views with every locale and with a generated locale containing markup. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UnF3JNHe2m9RQM1BRKdBMY
__() returns the key for texts without an entry, so en.php only needs the entries that differ from their key. The locale tests compare the other languages with the texts used in the code instead. Removes the unused keys Recent and Exit (Exit renamed to Log out in ja.php). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UnF3JNHe2m9RQM1BRKdBMY
# Conflicts: # locales/en.php
…it message label, upload alerts, page errors Adds __js() for texts in inline scripts, German translations, and tests that check these texts for every locale. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UnF3JNHe2m9RQM1BRKdBMY
…uests, IP and git errors Adds German translations and per-locale tests for these texts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UnF3JNHe2m9RQM1BRKdBMY
Also fixes the underscore emphasis example, which was closed with an asterisk. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UnF3JNHe2m9RQM1BRKdBMY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This change adds comprehensive test coverage for locale files and improves translation coverage throughout the codebase by extracting hardcoded English strings into translatable keys.
Key Changes
New Tests
tests/Unit/LocaleFilesTest.php: Validates all locale files for correctnesstests/Integration/LocaleTest.php: Tests locale functionality in the running applicationtests/Integration/LocaleEscapingTest.php: Security test for translation escapingCode Improvements
index.php: Extracted hardcoded strings into translatable keysfunctions.php: Added__js()function for translating JavaScript string literalsauth.php: Made IP restriction message translatable (with fallback for api.php)Locale File Updates
locales/en.php: Restructured to only contain entries that differ from their keyslocales/de.php,locales/oc.php,locales/ja.php:Notable Implementation Details
__()function returns the key itself if no translation exists, so the English locale only needs entries where the translation differs from the key__js()function useshtml_entity_decode()to convert HTML entities back to characters before JSON encoding, ensuring proper JavaScript string literalshttps://claude.ai/code/session_01UnF3JNHe2m9RQM1BRKdBMY