Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jan 16, 2015 at 11:40 AM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
6
Question by eheimburg · Apr 09, 2011 at 03:46 AM · editoreditorguilocalizationtranslation

How do I localize strings in the editor?

I made a game, and all is well. Except I've been asked to provide translated versions. I can't figure out ANY sort of workflow that will be maintainable for this... looking for advice!

I'm not new to localization, and making/maintaining string tables isn't the problem. The problem is finding a way to integrate the tables into the editor GUI so that I can still see the original strings easily (and not just the string's IDs).

Many of the strings in the game were typed into the Unity editor. For instance, "talk trees" were implemented as simple arrays of nodes, each node containing some strings and some flags. Very convenient for development. But now I can't get the strings out of the editor.

One reasonable workflow would be to replace each of those strings with a token -- for instance the string "Hi there" might get replaced by "#142". That would give me the info to look up string #142, which would be "Hi there" in the appropriate language. But I need to be able to see the ORIGINAL string in the editor -- seeing just "#142" is completely useless if I need to fix bugs or make improvements to the game.

I've tried writing a plugin that keeps track of the currently-active text field in the editor -- that way the plugin could see that it says "#142" and display "#142 = 'Hi there'" in a little window. But I can't get that to work.

I've tried... well, I've tried all sorts of things. But I'd love to hear somebody who has a workflow that works... and that doesn't make the editor completely useless for future editing!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cregox · Nov 16, 2011 at 07:34 PM 0
Share

I just hope our work wasn't completely in vain: http://forum.unity3d.com/threads/35617-Text$$anonymous$$anager-Localization-Script

2 Replies

  • Sort: 
avatar image
3
Best Answer

Answer by yoyo · Apr 09, 2011 at 05:29 AM

You could replace each string with a serializable structure (implemented as a class, since Unity doesn't like serializing structs), something like this (C#):

[System.Serializable] public class LocalizedString { [SerializeField]private int _ID;

 #if UNITY_EDITOR
 [SerializeField]private string _Text;
 #endif

 public string Text
 {
     get { return LocalizationSystem.GetText(_ID); }
 }

 public override string ToString()
 {
     return Text;
 }

}

Inside your components instead of using strings, you would use LocalizedStrings:

public LocalizedString MyString;

When you access the text from code, you would use MyString.Text instead of simply MyString. You need to implement the LocalizationSystem.GetText to do your string table lookup.

The _Text field is only needed in the editor, so it can be compiled out in the final build to save some space. Both _Text and _ID are private, but marked for serialization, so your client code can't peer into internal details it doesn't need to know about.

The ToString override lets you dump MyString into String.Format or similar methods without having to reference the Text property, and also should make it show up nicely in a debugger.

You could go beyond this to augment the editor to understand the currently selected language, and have an editor feature to iterate through your scene, replacing the _Text field of all LocalizedStrings with the text string from your language of choice.

Disclaimer: I haven't done this myself, but I've used string localization tables extensively in a former life and will need to do so again at some point soon. Let me know what you come up with, I'd be interested to hear how it goes.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image eheimburg · Apr 14, 2011 at 09:40 PM 1
Share

Thanks, I didn't know about the UNITY_EDITOR define. Having some tentative success with this approach, will post more when I have it all worked out!

avatar image yoyo · Jan 20, 2013 at 10:09 AM 0
Share

@eheimburg, did you end up with a good solution to this? Anything you can share with the rest of us?

avatar image
0

Answer by CodePin · Jan 16, 2015 at 11:39 AM

Hi...

Reference this unity asset : DocsPin Asset , Overview

Following are the features of DocsPin. - Retrieve data from Google Drive - Save and upload in local file all of Google Drive data - Protect and encode data - Manage multi-language text data

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Initialising List array for use in a custom Editor 1 Answer

Size of the header of the EditorWindow 1 Answer

EditorApplication.projectWindowItemOnGUI and sub assets 1 Answer

How to create EditorWindow on game load 1 Answer

How to provide custom descriptions for EditorGUI.EnumPopup? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges