feat(i18n): full multilingual system for 27 languages#1297
Conversation
|
While working on the multi-language implementation, I noticed that several tests (specifically BuildQueueCancelTest, BuildQueueTest, ResearchQueueTest, and UnitQueueTest) are currently failing because they rely on hardcoded English strings. In tests/AccountTestCase.php (around line 598), the assertion looks for the exact string: Since the application now supports different locales (like Italian), the $responseContent returns translated text, causing the test to fail. |
That means you have to update the test to accept the new, translated text. |
Yes, as you are introducing new elements, the tests are part of this PR and should be updated to reflect those changes. From the CONTRIBUTING.md:
|
|
@lanedirt dont merge this i have other update in coming i have translate all |
|
If a PR isn't done yet or needs more time, you can always leave it as a draft or convert it to one. |
6a3d626 to
483b32d
Compare
There was a problem hiding this comment.
Hi @piciolo, thanks for the work on this. I just briefly reviewed the changes but I see a lot of unrelated changes to the tests: many tests seem to have been removed and/or heavily refactored which is out of scope of this PR.
Please check all changes to the test files and make sure that any changes to the tests only reflect textual changes. Unrelated changes to tests such as general refactoring should be in its own PR.
There was a problem hiding this comment.
Hi @lanedirt, thank you for the feedback — you were right.
The branch history has been fully rewritten (force-pushed) to contain only i18n-related changes. The five test files that had unrelated modifications (FleetDispatchAcsAttackTest, FleetDispatchAttackTest, FleetDispatchMoonDestructionTest, MerchantTest, ResearchQueueTest) are now identical to main — verified with git diff origin/main.
The only test files that still differ from main are the four below, and every change in them is a direct consequence of views no longer emitting hardcoded English strings:
AccountTestCase.php—assertCancelBuilding()now calls__()to match what the Blade views emit after i18n;assertEmptyBuildingQueue()/assertEmptyResearchQueue()switch from asserting hardcoded English text (which would fail in any non-English locale) to asserting the structural DOM markerclass="idle"that is language-independent.AllianceDepotTest.php— updates'There are no holding fleets!'to'No allied fleets currently in orbit.', which is the English value of the newt_ingame.alliance_depot.no_fleetskey.ChatTest.php— updates'List of your chats'→'Conversations'and'Player list'→'Players'to match the newt_ingame.chatkeys.PhalanxTest.php— updates'Own fleet'→'Your fleet'to match whatPhalanxServiceactually returns for the scanner's own fleets (the old assertion was incorrect regardless of this PR).
No logic, structure, or teardown of any test was changed.
28211da to
f403a00
Compare
f403a00 to
96be18e
Compare
Preview deploymentPreview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.
Test accounts (click to expand)
This preview will be automatically destroyed when the PR is closed. |
bdd82a8 to
e5e71d5
Compare
Rebased onto current main (squashed). Adds the multi-language infrastructure (LanguageController, Locale middleware with the 27 OGame community locales + zh-TW kept for backward compat, PlanetNameLocalizationService, language dropdown in the options/outgame UI) and the translation files for all supported languages. Conflict resolutions: kept main's null-guards + Vite (@Vite) while layering the i18n changes on top; dropped the obsolete Laravel Mix built assets (main migrated to Vite — the ingame bundle is regenerated by the build).
e5e71d5 to
055c5a0
Compare




Summary
This PR introduces a comprehensive multilingual system for OGameX, covering both the localization of existing in-game UI strings and the addition of full translation support for 27 languages.
All translations have been sourced directly from the official OGame game to ensure accuracy and consistency with the original game experience.
What changed
— 27-Language Translation Infrastructure
New languages:
ar,br,cs,cz,da,de,dk,el,en_US,es,es_AR,es_MX,fi,fr,gr,hr,hu,it(extended),ja,jp,mx,nl(extended),pl,pt,pt_BR,ro,ru,se,si,sk,sl,sr,sv,tr,tw,us,yu,zh_TWEach locale includes:
t_buddies,t_external,t_facilities,t_galaxy,t_ingame,t_layout,t_merchant,t_messages,t_overview,t_resources,wreck_fieldNew infrastructure:
app/Http/Middleware/Locale.php— per-request language detection,SUPPORTED_LOCALESconstantapp/Services/I18n/OGameLocale.php— locale resolution serviceapp/Console/Commands/I18n/—BuildDictionary,GenerateLocales,MapKeysArtisan commandspublic/img/flags/*.svg— 27 flag icons for the language switcher UIAuth views migrated to i18n:
outgame/layouts/main.blade.php— language switcher in login/register pageoutgame/forgot-password.blade.php,outgame/reset-password.blade.phpoutgame/mail/reset-password.blade.php,outgame/mail/retrieve-email.blade.phpapp/Providers/FortifyServiceProvider.php— registers localized auth views— Localized Default Planet / Moon Names
CreateNewUser,PlanetServiceFactory, and a newPlanetNameLocalizationServiceensure that the default names for a player's first planet ("Homeworld"), colonies ("Colony"), and moons ("Moon") are stored in the database already translated into the player's locale at creation time.When a user changes their UI language (via
/lang/{lang}or the in-game Preferences form),PlanetNameLocalizationService::retranslateDefaultNamesForUser()automatically renames any planet/moon whose current name still matches a default name in any supported language. Custom names chosen by the player are never touched.Translation keys (
t_ingame.overview.homeworld,.colony,.moon) have been added to all 39 language files, sourced from the official OGame game.Notes for reviewers
routes/web.phpincludes thelanguage.switchroute required by the language switcherpassword.email-lookup) are guarded withRoute::has()for forward compatibilityLocalemiddleware is registered inbootstrap/app.php(already present onmain)Homeworld,Colony,Moon) unless the server admin runs the existingogamex:admin:translate-planet-namesArtisan command to perform a one-time batch migration.