EditorTranslationParserPlugin in Godot – Complete Guide

Welcome to our tutorial on utilizing the EditorTranslationParserPlugin class in Godot 4. As game developers embark on creating engaging experiences for players around the globe, localization and translation become essential elements in game design. This tutorial will delve into how Godot’s EditorTranslationParserPlugin can assist you in managing the translations for your game, covering the fundamentals and providing practical examples to illustrate its utility.

What is EditorTranslationParserPlugin?

The EditorTranslationParserPlugin is a powerful Godot engine class designed to facilitate the integration of multiple languages into your game. It allows developers to write custom parsers to extract translatable strings from various file formats such as .csv, .json, and more, ensuring you can localize your game’s content effectively.

What is it for?

This plugin comes into play when preparing your game for international audiences. By parsing files to extract strings that need translation, it helps to streamline the localization process by generating a Portable Object Template (POT) file, which is used in the translation process.

Why should I learn it?

Learning how to use the EditorTranslationParserPlugin can significantly enhance the localization workflow for your Godot projects. Being able to add custom parsers gives you the flexibility to manage game content translations easily and efficiently. This capability is essential if you aim to reach a global market and tailor your game to speak to players in their native language.

Furthermore, understanding this plugin allows you to contribute to a localization-friendly game development environment, making your games more accessible and enjoyable for a diverse audience. With Godot’s strong community support, learning how to implement this feature can open up many opportunities for collaboration and growth in game development.

Stay tuned as we dive into the coding aspect of EditorTranslationParserPlugin in the next sections. Whether you’re a beginner or an experienced coder, these examples will help you get a grip on localizing your Godot game projects.

CTA Small Image

Setting Up the EditorTranslationParserPlugin

Before we dive into coding with the EditorTranslationParserPlugin, we must first set up our development environment properly.

Ensure that your Godot Editor is up to date and that you have initialized a new project. Once you are set up, we can begin writing our first script to extend the EditorTranslationParserPlugin:

extends EditorTranslationParserPlugin

func _parse_file(file: String, extracted_strings: Array):
    # Your custom parsing logic will go here

This script serves as a template for our plugin. The _parse_file() function is where we will define how to parse our specific file type.

Parsing CSV Files

CSV files are a common format for storing translation strings. Our first example demonstrates how to parse a CSV file and add each string to the translations:

func _parse_file(file: String, extracted_strings: Array):
    var csv_file = File.new()
    if csv_file.open(file, File.READ) != OK:
        return false
    while not csv_file.eof_reached():
        var line = csv_file.get_csv_line()
        for string in line:
            if string.strip_edges() != "":

    return true

This plugin will now read through every line of a CSV file and extract non-empty strings.

Handling JSON Files

If your game stores translatable strings in JSON format, the following example shows you how to parse them:

func _parse_file(file: String, extracted_strings: Array):
    var json_file = File.new()
    if json_file.open(file, File.READ) != OK:
        return false

    var json_text = json_file.get_as_text()
    var json_data = parse_json(json_text)
    _parse_json_value(json_data, extracted_strings)

    return true

func _parse_json_value(json_value, extracted_strings):
    match json_value:
            for key in json_value.keys():
                _parse_json_value(json_value[key], extracted_strings)
            for item in json_value:
                _parse_json_value(item, extracted_strings)
            if json_value.strip_edges() != "":

The _parse_json_value() function is recursively called to deeply traverse nested JSON objects and arrays, extracting all string values.

Managing Text Files

Text files may also contain strings for our game that need to be translated. Here’s how to extract strings from a simple text file:

func _parse_file(file: String, extracted_strings: Array):
    var text_file = File.new()
    if text_file.open(file, File.READ) != OK:
        return false
    while not text_file.eof_reached():
        var line = text_file.get_line()
    return true

With this script, each line in your text file will be stripped of whitespace and added to the extracted strings array.

Parsing Custom File Types

Perhaps your game utilizes a custom file format. In that case, you can write a parser specific to that format. The example below demonstrates a basic structure for parsing a hypothetical “.myformat” file:

func _parse_file(file: String, extracted_strings: Array):
    if not file.ends_with(".myformat"):
        return false
    # Custom parsing logic for the .myformat file
    # Here, we'll just add a dummy string for the sake of an example
    extracted_strings.append("Translatable string from .myformat file")
    return true

In this example, we’re checking the file extension and then adding a sample string to the translations. Your custom logic will vary depending on the structure of your file.

With these foundations in place, you are now equipped to extend the EditorTranslationParserPlugin for various file formats. In the following parts, we’ll delve further into how to use these parsing methods in a full Godot plugin. Stay tuned to discover how you can fully localize your games with ease using Godot 4.

As we continue to dive deeper into the localization process using Godot 4, let’s explore more complex examples while considering different kinds of in-game content that may require localization. We’ll look at translating dialogue, user interface elements, and other game assets.

When localizing dialogue, game developers often work with scripts that include character names, speech, and choices. Let’s assume these are stored in a JSON file with a specific structure:

func _parse_file(file: String, extracted_strings: Array):
    # ... (omitted previous JSON parsing setup code)
    for dialogue in json_data["dialogues"]:
        for choice in dialogue["choices"]:

In this example, we extract character names, dialogue text, and any associated choices from our JSON, making sure to strip any leading or trailing whitespace.

For user interface elements such as buttons, labels, and menus, it’s likely we’d store their text in a CSV file structured to note the object’s name and the text to display:

func _parse_file(file: String, extracted_strings: Array):
    # ... (omitted previous CSV parsing setup code)
    while not csv_file.eof_reached():
        var line = csv_file.get_csv_line()
        if line.size() >= 2:
            var object_name = line[0].strip_edges()
            var display_text = line[1].strip_edges()
            if object_name != "" and display_text != "":

Here we only extract the display text, not the object name, because we assume the object names are not translatable.

Moving on to audio files, you might have voiceovers or sound bites that also require localization. In this case, you might maintain a list of audio file names that need to be swapped based on the player’s language settings:

func _parse_file(file: String, extracted_strings: Array):
    var audio_list = File.new()
    if audio_list.open(file, File.READ) != OK:
        return false
    while not audio_list.eof_reached():
        var audio_file_name = audio_list.get_line().strip_edges()
        if audio_file_name.ends_with(".ogg"):

This example will add each audio file’s directory (which could be a language code) to the strings that can be localized.

Also, games often include data files listing enemy attributes, item descriptions, or level details. When these are stored in .json format, they can be parsed as follows:

func _parse_file(file: String, extracted_strings: Array):
    # ... (omitted previous JSON parsing setup code)
    for item in json_data["items"]:

We extract the name and description for each item from our JSON data file for localization.

We can further tailor our parsers to handle various cases, such as when certain texts are context-sensitive or when only specific parts of a data file require localization. It’s important to consider these aspects to ensure that each string we translate makes sense within the context of the game.

All these examples form the basis of creating a robust localization system within Godot 4, making use of the versatile EditorTranslationParserPlugin to handle game translations efficiently and effectively.

Through the use of these scripts, We’re ensuring that our games are not only accessible but also appealing to players from all over the world. We empower developers to tell their stories and build immersive worlds that can be fully appreciated in any language, a testament to the truly global nature of gaming today.

Join us as we continue to explore the best practices for game localization and implementation, and stay with us on your journey to becoming a Godot 4 localization pro. Keep experimenting with these examples, and see how they can be adapted to fit the unique requirements of your game.

In the world of game development, localizing in-game tutorials and help systems is crucial. These often come in the form of text-heavy instructions or tooltips and might involve a mix of dialogue and UI elements. To manage such content, we could expect a dedicated JSON file where each tutorial step is well-defined. Below is an example of parsing such tutorial content:

func _parse_file(file: String, extracted_strings: Array):
    # ... (omitted previous JSON parsing setup code)
    for tutorial_step in json_data["tutorial"]:

        for tooltip in tutorial_step["tooltips"]:

Extracting each title and description ensures that players can receive instructions in their native language, which is essential for accessibility and user experience.

Localization does not stop at text. Numerical values, such as dates and times, can also require localization due to different formats used across the world. Here’s a simple example of how a custom parser might identify and register these for localization in a text file:

func _parse_file(file: String, extracted_strings: Array):
    var text_file = File.new()
    if text_file.open(file, File.READ) != OK:
        return false
    var date_time_regex = RegEx.new()
    while not text_file.eof_reached():
        var line = text_file.get_line()
        var results = date_time_regex.search_all(line)
        for result in results:
    return true

This will register all the date and time formats that match the provided regex patterns.

Achievement and trophy text often have unique titles and descriptions. Here is an example of parsing an achievements file which may be stored in CSV format:

func _parse_file(file: String, extracted_strings: Array):
    # ... (omitted previous CSV parsing setup code)
    var first_line = true
    while not csv_file.eof_reached():
        var line = csv_file.get_csv_line()
        if first_line:  # Skip headers if any
            first_line = false

        var achievement_title = line[0].strip_edges()
        var achievement_description = line[1].strip_edges()
        if achievement_title != "" and achievement_description != "":

Skipping the first line in this case assumes that the CSV file contains headers which are not necessary for the translation process.

Lastly, in-game announcements or news items might come from an external feed, such as an API delivering new content in JSON format. This example would parse such content:

func _parse_file(file: String, extracted_strings: Array):
    # ... (omitted previous JSON parsing setup code)
    for announcement in json_data["announcements"]:

Through this process, recently fetched announcements can be tagged for translation, ensuring that all players can enjoy the latest news in their primary language.

By incorporating these coding snippets, game developers can expand the international reach of their titles. The use of the EditorTranslationParserPlugin demonstrates Godot 4’s commitment to providing developers with the tools they need to create inclusive and accessible gaming experiences. As we see, localization encompasses not only direct in-game text but also any dynamic content that could enhance the player’s engagement, from achievements to real-time announcements.

Remember to continuously test these parsers with dummy data to refine the logic and catch exceptions. By iterating and improving these functions, we are setting up a solid foundation for a seamless translation process that accounts for the diverse ways players interact with our games.

Continuing Your Game Development Journey

Delving into localization with Godot 4 is just the beginning of an exciting journey in game development. To continue nurturing your skills and mastering game creation, exploring the Godot Game Development Mini-Degree is an excellent next step. This comprehensive program provides in-depth instruction on building cross-platform games with the latest version of Godot, encompassing topics from working with both 2D and 3D assets to understanding the nuances of gameplay mechanics across different game genres.

Whether you’re just starting out or looking to deepen your existing knowledge, our Mini-Degree offers both the foundational learning for beginners and the advanced challenges that seasoned developers seek. As always, at Zenva, we strive to equip you with practical skills that culminate in a portfolio of real projects, proving your capability in the field of game development. For those who wish to explore more, our broad collection of Godot courses can further augment your learning journey, ensuring that you’re well-versed in creating the games you envision.

Take this step with us at Zenva, where learning is structured, comprehensive, and always aligned with the latest industry standards. Expand your expertise, build amazing games, and join a global community of developers on the same path to success.


Embarking on the journey of localizing your game with Godot 4 is a significant step towards crafting games that resonate with a global audience. By leveraging the power of the EditorTranslationParserPlugin, you open up a world of possibilities, breaking down language barriers and connecting with players on a more personal level. But remember, this is just a fragment of the vast universe of game development, and there’s so much more to learn and explore.

As you continue to build and innovate, we invite you to delve deeper with our Godot Game Development Mini-Degree, a resource designed to elevate your skills and unleash your creative potential. At Zenva, we’re not just about teaching; we’re about creating a transformative learning experience that guides you from curious learner to proficient developer. So, let’s keep building, learning, and growing together – the next chapter of your game development story awaits!

Python Blog Image

FINAL DAYS: Unlock coding courses in Unity, Godot, Unreal, Python and more.