Generate a pseudo-locale from your Laravel lang file
Paste a PHP or JSON lang file and get back the same file with every string accented, padded and
wrapped in markers, like [!! Šåṽé çĥåñĝéš ~~~~ !!].
Placeholders, plural conditions and HTML are left exactly as they were, so the file works in your app.
The file is transformed in memory and never stored.
What pseudo-localization catches
Pseudo-localization replaces real translations with a mechanical transformation of your source text. Your team can still read every screen, but the app behaves as if it were running in a foreign language. Three kinds of bug become visible at a glance:
-
Hardcoded text. Every string that went through
__()is wrapped in[!! … !!]. Plain English without markers never touched your lang files, which makes it a hardcoded string. - Layouts that cannot grow. The padding makes each string longer by the percentage you choose, so buttons that overflow, labels that wrap onto a second line and table headers that get cut off show up before a real translation does it to you.
-
Encoding and font problems. Accented letters such as
å,ĝandɱexpose a font without the glyphs, a database column that is not UTF-8, or code that measures strings in bytes instead of characters.
What is kept intact
Only visible text is changed. Laravel placeholders like :name
and :count keep their exact spelling, so replacements still work.
Plural lines are split on the pipe the same way trans_choice()
splits them, each form is transformed and marked on its own, and explicit conditions such as
{0}, {1} and
[2,*] stay at the start of their segment. HTML tags and their
attributes, HTML entities like &, printf-style
specifiers like %s and anything inside braces, such as
{user} for a JavaScript i18n library, nested groups included,
are copied byte for byte. Keys are never touched.
Using the output in Laravel
Treat the pseudo-locale as one more language. Save the output for every file of your source
locale into a folder of its own, for example lang/en_XA/auth.php
and lang/en_XA/messages.php, or as
lang/en_XA.json for JSON strings. Then switch to it only in
local development, for instance with a small middleware:
public function handle(Request $request, Closure $next): Response
{
if (app()->isLocal() && $request->boolean('pseudo')) {
App::setLocale('en_XA');
}
return $next($request);
}
Visit any page with ?pseudo=1 and click through it. Keys missing
from the pseudo files fall back to your fallback locale and appear in plain English, which is a
useful signal too: regenerate the files whenever you add strings.
One Laravel detail to know: trans_choice() picks plural forms from
a fixed table of locale codes in MessageSelector, and
en_XA is not in it, so every count returns the first form unless
an explicit condition such as [2,*] matches. To exercise plural
forms, name the folder after an English locale that is in the table and that you do not ship, such
as en_ZW. The
trans_choice() deep dive
explains how that table works.
Common mistakes
Running pseudo-localization once and forgetting it is the most common one; the value comes from making it part of how you review new screens. The second is pseudo-localizing only some files: validation messages, emails and notifications live in their own lang files and need the same treatment. The third is reading markers too literally. A string without brackets is not always a hardcoded literal; it can also be text from the database or a third-party package. To find the literals directly in your templates, paste them into the Blade hardcoded string scanner or read how the Code Scanner finds hardcoded text across a whole project. Once real translations arrive, the lang file diff checks that they kept every placeholder and plural form.
Frequently asked questions
What is pseudo-localization?
A testing technique that replaces your translations with a mechanical version of the source text: accented letters, extra length and visible markers. The interface stays readable for your team, but untranslated hardcoded text, layouts that cannot grow and font or encoding problems become obvious before any real translation exists.
How do I use a pseudo-locale in Laravel?
Save the generated files in a locale folder of their own, for example lang/en_XA/messages.php or lang/en_XA.json, and call App::setLocale('en_XA') in local development, for instance from a middleware that reacts to a ?pseudo=1 query parameter. Laravel loads it like any other locale.
Will placeholders and plural forms still work?
Yes. :placeholders, {braced} groups, HTML tags, HTML entities and printf-style specifiers are copied unchanged, and plural lines are split on the pipe with each {0} or [2,*] condition kept at the start of its segment. Note that Laravel's plural table does not know en_XA, so trans_choice() returns the first form there unless an explicit condition matches; name the folder after a listed English locale you do not ship, such as en_ZW, to test plural selection.
How much expansion should I use?
The default of 30% is a reasonable starting point for whole-page testing. Raise it when you are checking tight components such as buttons, tabs and table headers, and use 0% when you only want the markers and accents.
Does pseudo-localization test right-to-left layouts?
Not this tool. Accents and padding exercise length and character handling, but right-to-left languages also need dir="rtl" on the document and mirrored layout rules, which are best tested with a real Arabic or Hebrew locale.
Useful? Link to it
The tool is free and stays free. Paste this into a README, a wiki page or a forum answer.
<a href="https://langsyncer.com/tools/pseudo-localization">Pseudo-Localization Generator</a> by LangSyncer
Other free tools
Lang File Converters
Convert between Laravel PHP arrays, JSON, YAML and CSV — nesting, placeholders and plural pipes preserved.
Lang File Diff & Validator
Compare two locales and find missing keys, extra keys, broken :placeholders, plural forms that do not match and strings nobody translated.
Untranslated Key Detector
Scan any website for leaked i18n keys: dot-notation identifiers, missing-translation markers and unrendered placeholders your users can see.
Blade Hardcoded String Scanner
Paste a Blade template and find text that should be behind __() — with suggested keys and a generated lang file.
Found hardcoded strings? Extract them automatically
LangSyncer's Code Scanner finds the text that never went through __(), suggests keys, rewrites your templates, then translates the new keys with AI and publishes them without a deploy.