Search Results for

    Show / Hide Table of Contents

    Loading Translations from Google Sheets

    You can load translations from an online .csv documents using No Such Stuido: Localization's GoogleSheetsTranslationConnector component. The component is flexible and can work with any url that serves a .csv file. Google Sheets is one way to host your .csv files online.

    Note

    Comma Separated Values, or CSV, is a popular file format for storing tabular data like that of a spreadsheet.

    This is more flexible that the offline solutions because you are able to improve or fix translations after your release without needing to push an update.

    1) Setting up a Google Sheets document to be accessible publicly

    1. In your web browser, go to https://drive.google.com
    2. Press the "New" button at the top left, then select "Google Sheets"
    3. From the menu go to "File -> Publish To Web".
    4. Under the "Link" tab, select "Entire Document" and "Comma-separated values" from the drop downs. Then click publish.
    5. Copy the link and paste it into a new browser tab. A .csv file with you sheet's content should download.
    Your browser does not support the video tag.

    If your Google sheets document has multiple sheets, you need to generate multiple links, one per sheet. You can do that from the "Publish To Web" window.

    Your browser does not support the video tag.

    2) Enter Translations into your Google Sheets document

    You can enter your translations in your sheet in the same two formats that the CSV Translation Source accepts.

    1. Single translation per line

    In this format each line contains 3 values. The phrase, the locale (language) and the translation. The first line can optionally be the header and you have the option to ignore it when importing the data in Unity.

    single translation per line CSV format

    2. Multiple translations per line

    In this format, you can provide multiple translations for the same phrase in each line. The first line must start with and empty cell followed by the list of locales (languages) for translations. Each subsequent line starts with the phrase, followed by translations into the langauges defined in the first row. All lines need to contain the same number of fields.

    multiple translation per line CSV format

    Regardless of what format you use, you can split your translations into multiple documents. How you want to split your translations is up to you. We recommend splitting your translations in two ways to keep each sheet from growing too large and becoming unmanagable:

    1. Group phrases logically and include each group in a separate sheet. For example phrases in your game would be split into these groups: main menu phrases, level1 phrases, level2 phrases, new year online event phrases, etc.
    2. Include translations for each language in a separate spreadsheet. This way the translators for each language work in their isolated sheet and won't accidentally mess up translations for other langauges.

    3) Setup Unity to Use the Public Google Sheet

    Not that you have a spreadsheet with your translations, let's use them in a Unity scene. It is best if you are familiar with the general architecture of No Such Studio: Localization. If not it may be helpful to see the Getting Started page. Here we are going to start with a scene with localization and only replace the local translation sources with GoogleSheetsTranslationConnector component.

    1. Start with a scene that has localization setup. If you are new you can start with "5-CSVSourcesScene" from the Demo scenes included with this asset.
    2. Delete the translation sources if there are any. In the demo scene, delete "MultiFormatTranslationSource" and "SingleFormatTranslationSource" GameObjects.
    3. Create a new GameObject named "GoogleSheetsTranslationSource"
    4. Add a GoogleSheetsTranslationConnector component. Note that this adds a StandaloneTranslationSource component to our GameObject as well. The connector uses this to store the downloaded translations locally.
    5. Set the "Sheet URL" to the URL of the published sheet you made in step 2.
    6. Set the "CSV line format" to the format you used in your spreadsheet.
    7. Set the "Has Header" flag depending on whether you used a header row in your spreadsheet that needs to be ignored. When using "multiple translations" format, the header row is mandatory and cannot be omitted because it contains the name of langauges for translations.
    8. To load the translations in Editor, press the "reload" button in the inspector.

    If things work correctly, you should be able to see the translations from your google sheet in the StandaloneTranslationSource component.

    Inspector for GoogleSheetsTranslationConnector

    The status of the last load will be shown in Inspector for the Google Sheets Connector component, along with a console error message if loading translations from the online document fails for whatever reason.

    Inspector for GoogleSheetsTranslationConnector with Error

    See Also

    • Read the Getting Started page to see No Such Localization in action.
    In This Article
    Back to top Generated by DocFX