Repository navigation
feat(install): the install wizard in five languages, with a language switch - #192
Conversation
… top, and its language as the default
…h, and as the default
db2e7ad to
0f3b622
Compare
#192 wrote the wizard's 56 new texts in the five complete languages. Spanish, complete since #190, had 10 of the 66 texts of the install group. They are written in the "usted" of the Spanish files and with their words (Nombre de usuario, Contraseña, Apellidos, pasarela de pago), in the order of the English file.
|
Thank you, Ertuğrul. The wizard is the first thing anyone installing PNLCS sees, and now it speaks their language: the browser's, or the one picked at the top, kept for every step and offered as the default on the last one. Four of the five new tests fail on main and all pass here; the installer, translation and hardcoded-text tests pass as well, and so does the full suite on the merged result (4219 passed). Merged with one commit on top (aad69b9, merge e142b22): the 56 new texts in Spanish. Spanish has had every text since #190, and its install group would otherwise have had 10 of 66. Checked on the merged code beyond the tests: the release package uploaded with no command run, walked through in English and in Turkish on nginx and PHP-FPM (a Turkish browser gets the wizard in Turkish, the switch goes to German and back, and the installation is saved with Turkish as its default language), and It goes out with the next beta. |
One command on a fresh server (install.sh), the release package installed without a command line, the wizard's database step tried before it is saved and run in short requests, the cron line on the finish page, the wizard in five languages (#192) and the last client texts translated (#191), the My Account language hint and the README's Docker quick start on image 1.5. No database change. A MINOR beta: features landed after 1.5.1-beta.1.
What
The install wizard now speaks the operator's language. It has a language switch at the top, and it offers that language as the system's default on the last step.
PNLCS ships 30 languages, but the wizard, the first thing anyone installing it sees, was English only. There were two reasons:
HardcodedViewTextTestcounted 59 strings across the six wizard views.SetLocaletakes the language from the database, and while the wizard runs there is none yet. A Turkish or German operator got five English screens before reaching a system they could set to their language.After this:
APP_LOCALE=dethe form showed English and saved it unless changed by hand. The list and its validation now share one list in the controller.Unchanged:
SetLocaleeverywhere else.How
App\Http\Middleware\InstallLocale:SetLocale;?lang=when it is one of the five;__('install.*'), 56 keys added to theinstalllanguage file next to the migration and scheduler texts already there, in en, tr, de, pl and zh. Names, errors and commands are passed as placeholders, so no translation carries a command line or an English word. The finish page's "Login asadmin" goes throughtrans_markup(), so the username keeps its<code>without a raw echo.InstallController:LOCALESdrives the last step's list and its validation;install.migrate_failed.The work is split into three commits: the middleware and routes, the views and translations, and the tests.
Tests
tests/Feature/InstallerLanguageTest.php, 5 tests, each on a fresh deployment (no lock, no administrator):Accept-Language: trthe requirements page is Turkish and<html lang="tr">.?lang=deis kept on the next step.?lang=xxwith a Japanese browser stays English.?lang=plit preselects Polish as the default language.Four of them fail on
main. The existing installer tests pass unchanged, and so doHardcodedViewTextTest(lower ledger),TranslationParityTest,DynamicTranslationParityTestandTranslationCoverageTest.Full suite: 4217 passed. The one failure is the
CurrencyAndBackupTestdb backup test, which fails onmaintoo in my local setup.