Localization - playliga/prototype GitHub Wiki
This guide is for anyone interested in contributing translations to help make the app available in more languages.
Important
Use the two-letter codes in the Set 1
column of the table.
The first thing to do is find the ISO 639-1 code for the target language.
Only the two-letter ISO 639-1 codes should be used when creating new translation directories and files.
For example, use es
for Spanish, fr
for French, or pt
for Portuguese.
Tip
If you're familiar with Git, skip this step and clone the repo instead!
The next step is to download the English translation files, which will serve as the foundation for the new translations.
Run the following commands in a PowerShell terminal window to get set up.
mkdir locale/en
$url = "https://github.com/playliga/prototype/raw/refs/heads/main/src/locale"
Invoke-WebRequest -Uri "$url/en/translations.json" -OutFile locale/en/translations.json
Invoke-WebRequest -Uri "$url/en/templates.ts" -OutFile locale/en/templates.ts
Important
Replace <code>
with your language code, such as es
, fr
, pt
, etc.
Now that the templates have been downloaded, rename them using the target language code.
Run the following in a PowerShell terminal window.
mv locale/en locale/<code>
With the environment set up, the next step is to review the structure of the two files used for translations.
Important
Never change the keys in the JSON structure.
This file contains all non-templated, plain-text strings used throughout the application.
These include labels, buttons, modal content, scoreboard text, and other static interface elements.
The file is organized into three main sections:
-
windows
- Contains translations specific to individual application views, such as the landing page, postgame screen, or settings window.
-
components
- Contains translations for reusable UI components, such as player cards or sponsor cards.
-
shared
- Contains commonly used translation strings that appear across multiple parts of the app.
As emphasized above, the key names within the JSON structure must remain unchanged.
Keys such as windows
, addComment
, or myReportedIssues
must stay exactly as provided, regardless of the target language.
Below is an example of what an English to Spanish translation would look like:
// english
{
"windows": {
"issues": {
"all": {
"noIssues": "You have no reported issues or feature requests."
},
"comments": {
"addComment": "Add Comment",
"assignee": "Assignee",
"delivered": "Delivered",
<...>
}
<...>
}
}
<...>
}
// spanish
{
"windows": {
"issues": {
"all": {
"noIssues": "No tienes problemas ni solicitudes de funciones reportadas."
},
"comments": {
"addComment": "Agregar Comentario",
"assignee": "Asignado",
"delivered": "Entregado",
<...>
}
<...>
}
}
<...>
}
Important
Preserve all variables within {{ }}
exactly as they appear in the original strings.
This file contains templated strings defined as enums. These templates are used for dynamic, context-aware messages such as emails or in-app notifications.
The values are written using placeholder syntax, such as {{it.profile.player.name}}
or {{it.persona.name}}
, which will be dynamically replaced at runtime based on the application's data.
While translating, it is important to preserve these placeholders exactly as they appear.
The surrounding sentence structure and formatting can be changed to fit the grammar and style of the target language, but the placeholders themselves must remain intact.
Below is an example of what an English to Spanish translation would look like.
// english
export enum WelcomeEmail {
SUBJECT = "Hey!",
CONTENT = `
Hi, {{it.profile.player.name}}!
My name is {{it.persona.name}} and I am your assistant manager. I just wanted to say hello and introduce myself.
Our first match is coming up so I wanted to let you know about a few things.
- Once you're in-game you can type \`.ready\` in chat and the match will start immediately.
- You can also wait for the warm-up timer to finish.
- After the match is over, you can close out your game as the score will be automatically recorded.
GL HF!
`,
}
// spanish
export enum WelcomeEmail {
SUBJECT = "¡Hola!",
CONTENT = `
¡Hola, {{it.profile.player.name}}!
Me llamo {{it.persona.name}} y soy tu asistente. Solo quería saludarte y presentarme.
Nuestro primer partido se acerca, así que quería contarte algunas cosas.
- Una vez que estés en el juego, puedes escribir \`.ready\` en el chat y el partido comenzará de inmediato.
- También puedes esperar a que termine el temporizador de calentamiento.
- Después del partido, puedes cerrar el juego, ya que la puntuación se registrará automáticamente.
¡GL HF!
`,
}
When the translation work is complete, the locale/<code>
directory should be zipped and sent to lemonpole
on our Discord server.
Alternatively, if familiar with Git, please feel free to open a pull request with the changes!