Member-only story
Tip: Use ChatGPT to Generate Locale Files for Localisation
Save Your Localisation Effort with ChatGPT
Non-Medium Members: Read this article free on Substack.
In today’s information age, software developers are likely to encounter localization at some point. For solopreneurs building their own app, considering localization is almost a must.
Let’s see an example first.
Programmers clearly don’t write the login page code twice. A common practice is to use a locale file that stores text keys, with the code referencing these keys. Below is an HTML snippet from the last paragraph of the WhenWise Login page.
<div class='row'>
<div class="col m12 s12" style="font-size: 15px; text-align: center;">
<span class="light"><%= t(:dont_have_an_account) %></span>
<a href="/sign-up" class="green-text"><%= t(:register) %></a>
</div>
</div>
Two locale keys are used: “dont_have_an_account” and “register”. In its English locale file (en-AU.html
), in YAML format (a common choice for locale files):
en-AU:
dont_have_an_account: "Don’t…