Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Smart Localization for Unity3D

Discussion in 'Assets and Asset Store' started by NiklasBorglund, Mar 13, 2013.

  1. zuric

    zuric

    Joined:
    May 22, 2014
    Posts:
    10
    The future of Smart Localization
    First I would like to thank the whole community for all the great response and feedback we’ve gotten; this is what keeps us working on and improving the plugin :)

    Going forward
    Soon we will be launching a PRO version of Smart Localization on the asset store. We do not have a date yet but it should be out this year :)

    FREE version
    The free version will continue to get updated with new features and stability fixed. Our goal is to continue with the free version as we have been and hopefully being able to devote more time to it. Nothing will get removed from the free version and we do want the free version to be adequate for most small teams and even bigger ones. The pro version will be aimed at improving productivity and flexibility of the plugin.

    PRO version
    The pro version will get more advanced features that improves the speed and convenience of the plugin. Some examples include Google Sheets, multi language editing window and hot loading CSV files from the file system.


    We would love to know what you guys think about all this.

    // Jakob( @zuric ) and Niklas( @NiklasBorglund )
     
    NiklasBorglund likes this.
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    I think that an additional pro version is absolutely fine and should help to support you guys. Just recently I've discovered the incredible awesomeness of Smart Localization for my projects and integrated it in the latest update for Simple IAP System, which has been released today. So I pretty much rely on your free version now, hoping that it won't go away in the foreseeable future.

    You did a great job on this asset and more advanced features are very welcomed!
    (e.g. CSV files or Google sheets with multiple languages in one doc)
     
    NiklasBorglund likes this.
  3. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    That is fantastic! Thank you for the kind words :)

    The one document csv/google sheets/(possibly xls) editing is a planned feature for the pro version :)
     
  4. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    Can you save the translations into any file type, instead of csv? I'm asking in order to keep the translations secure.
    I thought maybe it would be possible to serialize them, creating some basic obfuscation.

    Also, I'm guessing this will work without any problem with 2d Toolkit, but does it work with their bitmap text features?
    Does it also work with other plugns?

    Cheers
     
  5. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    No, you cannot save to any file format. Currently only to .resx and .csv. However, we do have plans for .xls as well. The reason for supporting any type is that we need to write custom exporters for most(if not all) of them.
    Let us know if there's a specific format you want, and we'll see what we can come up with :)

    Smart Localization handles only text, so this should work with any type of Label or Text Mesh, but you'll probably have to write a script to set the actual text on the label with data from the Localization system. We currently only ship the package with already written NGUI-classes, but it's not very hard to add more. Let me know if you need any help or pointers.

    We're not doing any special stuff on specific platforms, we're basically only manipulating text in various ways - so there shouldn't be any conflicts with any other plugins either.

    Hope that helps
    /Niklas
     
  6. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    Is it possible to serialize the text making it binary, then saving to a csv. and deserializing when using it?
    My reason for these queries is i dont want the player to have access to the translations until he/she has finished the game. Afterwards its actually cool to have it in a easy format, so players can contribute their own translations,etc.

    Also, you mentioned NGUI, when the ngui guy is the one making the new uGUI for 4.6, so are you guys going to support that, after 4.6 comes out?
    I mean its going to become the de-facto standard.

    Btw thanks for the kind reply. ;)
     
  7. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Yup, the plan is to make some utility for uGUI classes along the lines of the ones we have with NGUI now. And sure, we don't mind supporting other plugins too, it's just that we have to buy and learn about them first - and NGUI is the only applicable one I have in my private acc atm. Might have 2dtk lying around somewhere too, should look into that :)

    When do you want it to be serialized to a binary? When working with it in the editor? or at runtime? Because at runtime it's stored in the resources.assets file - and while it may be a fairly trivial file to hack - I don't see the normal end user(player) doing that.
    But i'm sure some encryption could be added to the file if that's something people want. Want me to write it down as a feature request?
     
  8. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    I'm thinking 'in the editor', because i simply want to ship the files in a 'not that easy to access' format.
    But you know the more options the better.
    Encryption would be good too, i thought about that. Like i said the more the merrier.

    2dtk is in promo atm, if you dont have it its certainly a good buy.
    Though I'm guessing that after uGUI is out officially everything is going to change around it so who knows.

    Thanks again, i'm surprised that you guys are so open.
     
  9. Goodev

    Goodev

    Joined:
    Feb 19, 2013
    Posts:
    25
    Hi, I have some problem for chinese localization.
    becuase, chinese has many region code
    zh-CHT
    zh-CHS
    zh-CN
    blah~blah

    But, if I use zh-CN, occur error.
    here's log.
    Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
    /Users/~/sdk/build-tools/android-4.4W/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/~/sdk/platforms/android-20/android.jar" -F bin/resources.ap_

    stderr[
    invalid resource directory name: res/values-zh-CN
    ]
    stdout[

    ]

    becuase, android resource path support
    zh-rCN(china), zh-rTW(taiwan)

    I can't change that code manualy, How can I fixed it.


    ///


    If I change SmartCultureInfo.xml, then works fine
    but GetSupportedSystemLanguage() is null

    How can I Distinguish Simplified Chinese and Traditional Chinese?

    your Git code can't do that
     
    Last edited: Nov 13, 2014
  10. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Can you try and delete the "res/values-zh-CN" folder and uncheck the "Generate store presence" toggle in the Smart Localization window? And report here if it works?
     
  11. Andrea-Luongo

    Andrea-Luongo

    Joined:
    Nov 18, 2014
    Posts:
    1
    Hi,
    We are using the Smart Localization plugin in our project and it works great. Our Sound Designer has an issue with the AudioSource inspector, the smart localization is changing the settings and he would like to use the normal settings of unity for the audio source inspector. Is that possible?

    Thank you
     
  12. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Never heard of this issue before, I'll look into it. When are the settings being changed?
     
  13. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Hello,
    we'll amazing Plugin!
    I used it now in a small project and it was a breeze to implement it :)
    Now i have 2 issues...
    1. French & Chinese is not available via Microsoft Translator ????
    2. How do i get the Country code of the default System Language?
    SmartCultureInfo gives me only English or German and not en or de. Is there a way to get this?
    many the and go on with it!
    Also make a Pro version! I will buy it only to support you!
     
  14. Kushulain

    Kushulain

    Joined:
    Sep 20, 2012
    Posts:
    19
    Hi Niklas, thanks you a lot for your tool ! It's really useful ! Thank you for sharing this for free !

    Your plugin doesn't seem to survive Unity recompilation though. It can be really handy when making (nearly-live-coded) UI, and because my UI use SmartLocalization, I can't do this anymore.

    I made a little fix (rather a hack), which works for me (if some people are interested) :

    Code (CSharp):
    1.  
    2. public class UI : MonoBehaviour
    3. {
    4.     private LanguageManager LangM;
    5.  
    6.     void Start ()
    7.     {
    8.         LangM = LanguageManager.Instance;
    9.     }
    10.  
    11.  
    12.     void OnGUI()
    13.     {  
    14.         #if (UNITY_EDITOR)
    15.         if (LangM.RawTextDatabase == null)
    16.             LangM.ChangeLanguage("en");
    17.         #endif
    18.    
    19.         GUILayout.Button(LangM.GetTextValue("mykey"));
    20.     }
    21.  
    22. }
    23.  
    Maybe you could add the "new" ISerializationCallbackReceiver Interface to the LanguageManager ?
    And reloading resources OnAfterDeserialize().

    What do you think ?
    I hope not to be mistaken, nor double posting.

    Regards,
    Kush.
     
    Last edited: Nov 22, 2014
  15. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Hello,
    Unity 4.6f2 crash when i want to update a csv file.
    To repo this:
    create a language, then save the csv, press update, select the csv and boom.
    Test on clean new Project as well...
     
  16. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    1. French & Chinese should be available. Try and go back to the main localization window and open up the translation window again. Otherwise, I'll look into it.
    2. SmartCultureInfo got a member variable called languageCode. That contains the "en" and the "de".

    Ok, thanks for the bug report. We'll look into it. We haven't really looked into the 4.6 beta yet.

    Yep, that's a good idea. I'll try and add it to the next version.

    And thank you for the work around fix :)
     
  17. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Hey Niklas,
    i made some test and French & Chinese is not available.
    Others are working fine... did not test all...
    Attached are some screens.
     

    Attached Files:

  18. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Ok, They don't work because they are not on this list - http://msdn.microsoft.com/en-us/library/hh456380.aspx. Smart Localization gets that list through their API and compares it with the language code.

    e.g You will have to use "fr" instead of "fr-FR"
     
  19. victor chen

    victor chen

    Joined:
    Nov 24, 2014
    Posts:
    2
    Hi, thank you for this plugin. We have a problem here.
    Smart Localization will copy the image and audio assets to its own directory. When we make an Android package, all the duplicate assets will be in the package, which make it unnecessorily larger.
    Do you have a solution for this? Thank you.
     
  20. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Hi, are you experiencing this, or is it just a concern? Because unless you are referencing the duplicates directly - it shouldn't be a problem.

    From this site: http://docs.unity3d.com/432/Documentation/Manual/ReducingFilesize.html
     
  21. victor chen

    victor chen

    Joined:
    Nov 24, 2014
    Posts:
    2
    Yes, I'm experiencing this. I have a scene with an image to be localized to two languages English and Chinese. So I have two images header_label_en.png and header_label_cn.png for that. I'm editing the scene in English, and when I make two localization with Smart Localization, they are copyed into the SmartLocalizationWorkspace directory with the key RocketMouse.HeaderImage as name. When I make the Android package, in the Editor Log, I find header_label_en.png and two version of RocketMouse.HeaderImage listed in the Used Assets. So header_label_en.png and the English version of RocketMouse.HeaderImage are the same, and they are both in the Android package.
    Meanwhile, I try to remove the header_label_en.png on the scene, which will leave a blank in the scene. When the app run, everything is fine, because I called LanguageManager.Instance.ChangeLanguage in the Start method which will call LanguageManager.Instance.GetTexture("RocketMouse.HeaderImage") to fill the blank area with the copyed version RocketMouse.HeaderImage. Now header_label_en.png is not in the Used Assets list, and the package size is really smaller.
    In a word, header_label_en.png is only used for editting in the scene, but not used when the app run. But removing it in the scene making later editing harder. So that's my problem. Thank you for your reply.
     
  22. Smartb0y

    Smartb0y

    Joined:
    Dec 9, 2012
    Posts:
    3
    Is it compatible with unity 5?
     
  23. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Ok, I understand. We'll put some thought into it and see if we can come up with a good solution. I wrote it down on our trello page.
    Maybe a utility script with a handy inspector script(where you choose the key) can be created to get the right texture from the localization system instead of the original file - that also can be used in the editor when not playing.

    Don't know. I don't have access to unity 5.
     
  24. Smartb0y

    Smartb0y

    Joined:
    Dec 9, 2012
    Posts:
    3
    it isn't compatible with unity 5 :(
    SmartLocalization_Runtime it is not
     
  25. Smartb0y

    Smartb0y

    Joined:
    Dec 9, 2012
    Posts:
    3
    in LocalizedGUITexture, LocalizedGUIText, LocalizedAudioSource..
    for example you should use Component.GetComponent<GUIText>() instead of Component.guiText
    to make it compatible with unity 5
     
    Last edited: Nov 28, 2014
  26. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Hello,
    well got this error message when build for Android.

    on iOS no Problem...
    do you have a quick solution?
    thx
     
  27. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Ok, we'll try and change that until the next version and hopefully it'll work :)

    I think a quick fix would be to remove those folders in your project and uncheck the google play store toggle in the main Smart Localization window.
    I think it's a bug in that feature, I have added it to our trello page :)
     
  28. stepan-stulov

    stepan-stulov

    Joined:
    Nov 26, 2013
    Posts:
    28
    Thanks a lot for the great work. I'm thinking on using this extension in our next project as it looks very promising and it follows the "good way" of doing things.

    I have a few architectural suggestions to the plugin though:
    • Get rid of the singleton for LanguageManager. Developers must be able to decide the lifecycle of objects in their app themselves. They want to create it when needed, to inject it where needed and to delete it when needed. Neither of these is possible now, as it's not definite when it's created, it has global access and it's never destroyed. Developer have different workflows, bootstrapper scenes, custom loading processes, etc. Do not interfere with those and dictate your own flow. Let them elegantly embed your solution into theirs rather than working around it. Do not steal the decision making from developers.

    • Do not dictate your own folder structure inside Unity project. I've tried to move SmartLocalizationWorkspace folder to a subfolder and the plugin window doesn't see the resource files anymore. Developers, again, have their custom project folder structures. Let them elegantly embed your solution into theirs rather than "pollute the root". What if I don't want the folder in my root? Do not steal the decision making from developers.

    • Do not dictate scene structure. The "LanguageManager" game object is created in the root of the scene automatically, while nobody asked for it. Developer have their custom scene structures, parenting, game object naming, etc. Provide a prefab that a developer then will instantiate when and where needed. Again, don't "pollute the root". Do not steal the decision making from developers.

    • Ok, this is a cosmetic thing. Naming of methods is confusing. Bring consistency to it. If you return a list of supported smart culture infos, then the method must be called GetSupportedSmartCutlureInfos and not GetSupportedLanguages. Is it a smart culture info or a language? A developer calls the GetSupportedLanguages method and expects a list/array of instances of some "Language" class, which is not there. You call the property CurrentlyLoadedCulture, while you call the process of loading the language/culture "change" — ChangeLanguage. Do I change or do I load? Etc, etc, etc. Rule of thumb: one word for one concept, no synonyms and no using one word for different things.
    I believe these might make your wonderful piece of work an even better product and perhaps even an asset store "standard". I would be very happy to pay for a pro version with these fixed.
     
    Last edited: Dec 1, 2014
  29. stepan-stulov

    stepan-stulov

    Joined:
    Nov 26, 2013
    Posts:
    28
    Feature suggestions:
    • Currently there is only one instance/workspace of smart localization with one file per language/locale. Imagine the following scenario. I have a localization of my main game's "wireframe". Things that are not dynamic and are always there. Things like OK button, Close button, etc. But then I want to load (via unity asset bundles e.g.) a pack of localized content. For instance when I enter a fire world, I would like to load an asset bundle with fire bosses, fire creatures, fire spells. I want this content to be on a separate server and I want it to be extensible without needing to roll out an app update to the market. I would then want to have another instance of smart localization for that unit of content, for the fire world. This of course could be solved via multiple unity projects with an instance of smart localizaiton in each. But if a developer wishes to keep everything in one project, such scenario is currently impossible.

    • The solution with copying the resources into smart localization's workspace folder is indeed a good care of the developers. Many of them though prefer their own managing of dynamically loaded resources. Perhaps they create a pool, cache objects, etc. In this case they would have to use string values with paths to those resources in the smart localizaiton instead of using your way of copying stuff and loading "under the hood". Perhaps a great addition would be a custom drag'n'drop or a custom selector tool, whereby a develoepr would have an option to choose the targeted resource by dragging'n'dropping it but yet get a string path to it in the localization entry value. Thus you'd combine the best of two worlds: easy of use of the traditional drag'n'drop and inspector yet no black boxing of processes under the hood. Perhaps you could simply introduce more types of key-value. Liek having a gameObject and a gameObjectPath.

    • Include comments of the language keys into the CSV export/import. These comments are only useful for developers, as long as they exist only in the Smart Localization window, while not being presented for the translating team in the CSV, where it's needed more.
    Let me know if my explanation isn't clear enough or/and you have additional questions.
     
    Last edited: Dec 1, 2014
  30. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Wow! Thank you for the feedback, it's much appreciated. It's things like this that evolves the project and makes it better :)

    You should be able to use LanguageManager without the singleton by adding it to a gameobject and using a reference to that instead, but I get your point. I'll try and explain why we chose a singleton for the project and a proposed solution that could make both "sides" happy.

    The singleton was something we thought alot of when we refactored the plugin for version 2.X. Both Jakob & I are not fans of the pattern, but we do think that there are some cases that it's an acceptable solution. Especially when the vision for Smart Localization has been to this point "Easy to use", and in some ways still are. But the focus has changed a bit to facilitate our pending PRO users, our main thought for pro would be everything that the free version is, but packed with more advanced features, the source available in the project, and a vision guided towards larger projects. What we can do is to enable the option(in a future version) in the language manager to simply disable the singleton(for both free and pro)?
    If the singleton is disabled, it either throws and exception or an error, and you'd have to rely on your own code for maintaining the languagemanager.

    How does that sound?

    The ability to move the workspace is a reasonable request and I wrote it down as a feature request on our trello page.

    You should be able to parent and rename the languagemanager any way you want, although I havent thoroughly tested that. But I will do. Maybe create some helper methods to open up that ability?

    Yes, you are right. The whole "Language" thing is mostly a legacy from Smart Localization 1.X - but you are right - we'll check and possibly replace the names with new ones and deprecate the old ones.

    I wrote down your (very reasonable) requests on our trello page.

    Again, Thank you for the feedback! :)
     
  31. stepan-stulov

    stepan-stulov

    Joined:
    Nov 26, 2013
    Posts:
    28
    Hey Niklas, glad to here you might have found it useful.

    I think that a choice of singleton or not must be in the area way outside of the tool. Singleton is a general pattern of referencing things, which functions on the "top" level of the app's architecture, while the Smart Localizaiton is a "niche" tool making its own work well and in an isolated manner. The two have absolutely nothing to do with each other. Give a class and if developer will want to have only one instance of it, they will instantiate it only once either with singleton or just actually instantiating it once. If you're very keen to provide comfort, perhaps singleton could be part of a tutorial. It feels weird to have it in the main bundle, as you're then no more providing a good one-task tool, but a multi-concern thing. It's simply not necessary.

    Perhaps you could just make a subfolder in the main Smart Localization folder. Developers, if working carefully, will seldom need to go to the folder. They'd rather just stay in the editor windows. One folder to rule them all. I will be able to hide it wherever I want and be happy with my root. Or maybe give an option for the workspace folder location be variable. Simply create your own custom "localization bundle" format and scan for those wherever they are.

    The problem is not only parenting/reparenting/renaming. The main problem is an automatically created game object that a develop hasn't asked for. Smart Localization again tries to play on multiple fields instead of being a niche one-task tool. Unity has wonderful concept for extending functionality, like prefabs, like resource loading, etc. If you just give me a prefab of the language manager, I will decide later if I want to create it by dragging and dropping to the scene, or by instantiating from code by reference to the prefab, or even loading it dynamically only in scenes needed, as my initial scene might be a skinny boostrapper. Don't give a process, give an atomic object that developers will embed into their own process. If then again you're keen to educate, you could make tutorials on how to use the language manager, be that mouse-programming, script programming, etc. Keep your API aside, and your convention aside, don't mix the two. What you're trying to educate the developers with from within the code belongs in documentation / best practices.

    Perhaps you've been trying to mimic the .NET's ResourceManager? I have these thoughts as you're actually using .NET's resource format .resx. Then a useful idea could be to simply mimic the whole API with "Smart" prefix. SmartCultureInfo, SmartResourceManger (=LanguageManager), etc. Devs familiar with the .NET option will feel at home.

    Thanks a lot!
     
    Last edited: Dec 2, 2014
  32. stepan-stulov

    stepan-stulov

    Joined:
    Nov 26, 2013
    Posts:
    28
    Ok, I've talked to my teamlead/architect and also gave some thought to how this tool would be used on bigger projects. Here are some concerns.

    The Smart Localization is a Unity centric tool. Which is good and bad.

    It's good, because while a programmer goes over game's architecture, he/she defines the set of keys along the development. No need to jump anywhere, all here, in Unity. It's kind of developer centric. I also love the concept of "root" language, where you create this kind of language "skeleton" which is then translated to (or rather filled with) multiple languages. Genius! The idea of strongly typed resources is also just great. I no more have to type a path to a localized audio file, I just drag'n'drop it. How much faster could that be!

    It's bad, because it's... well Unity centric. You don't want to tell translating teams/studios how to work and which tool to use. They're not gonna install Unity only for your one project. These guys work with Excel or god knows what else. In which case they'd probably love to have their nice XLS file with colors, alignments, empty lines, etc. While Smart Localization has import/export to/from CSV, this is in most cases not enough.

    While Smart Localizaiton seems a wonderful tool for solo, it may not scale that big. In big project Unity is no more a center a the world. It's just one more aspect/tool of the development.

    Solution? Hard to say. Maybe more importing/exporting formats?
     
  33. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Yeah, That's one of the things we are aiming for with pro to begin with - make it suitable for larger projects. Some of the features we have discussed to add in future releases of PRO is:

    * Google sheets
    * File Watching a CSV file(So you can change a csv directly in a text editor and the system automatically picks it up)
    * XLS - export (and possibly more formats)
    * The ability to split up languages into multiple text files - instead of a single large .resx file. (I think you could do alot more once a feature like this is in)
    * Exporting all the languages values into a single CSV file.
     
  34. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    I've just uploaded version 2.1004.
    Changelist
    ------------------
    * Updated the android store presence with correct folder names (e.g. sv-rSV instead of sv-SV)
    * Added a method to append data to the loaded language in language manager
    * Added a method to load a language with custom .resx data in the language manager
    * Updated the Inspector Scripts for GUIText, GUITexture and AudioSource to use GetComponent
    * Added Klingon in the available languages
    * Added a helper class for uGUI Labels


    I did add this, but to use the callback reciever in a runtime class requires Unity4.6. And we're building the dll:s with 4.5 atm - so i had to use pre processor defines to remove it :/ Although it will work when pro is out, since the source will be available then.

    I could try and build the project with 4.6 for you though to open up this functionality. Let me know and I'm sure we can work something out.
     
    Muckel likes this.
  35. jonrod29

    jonrod29

    Joined:
    Dec 4, 2014
    Posts:
    11
    Hello,

    i'm working on a 2D-game, and I just download your SmartLocalization tool and I think it's pretty awesome ! Simple to use, fast, great job guys ! :D
    However I have a couple of questions if you don't mind :
    1) Is it possible to add some link to the variables in the localization key? For example : you finished the level in {time} seconds. I didn't find out how to do this yet so I split my sentence in two (one before the variable, one after ^^')
    2) I encounter a problem when I build my project for web player. When I build it for windows standalone, I have no problem, but for my html file, when I open it, there's not text at all :/ Is it because I open it locally? Do I need a server to have the text? Or is it because of the location of the html file and the smartLocalization folder? (when we build for web player, it automatically create a folder)

    If those questions have been ansered before, I'm sorry >_<" I did search through the topic but didn't find the answers.

    Thanks anyway for the tool, and thanks in advance for your answer, I keep searching :)
     
  36. stepan-stulov

    stepan-stulov

    Joined:
    Nov 26, 2013
    Posts:
    28
    Just FYI, these links are officially called "format items" in MSDN, although I myself call them "slots". What you wanna do is already there, in the Mono/.NET framework. Check the string.Format( ) method. Simply create a necessary string with these little slots: {0}, {1}, {2}, and then:

    textMesh.text = string.Format("{0} has hit {1} with an {2}.", "Hero Mike", "zombie Joshua", "axe");
    // Hero Mike has hit zombie Joshua with an axe.


    And then, if you preserve the slots structure of such a string, translation process becomes standardized for all languages.

    Note that this technique has its limits. It doesn't work for languages, where nouns/verbs may have contextually variable forms. Like all the der/den/dem/des in German or different noun endings in Russian. This problem, however, could be solved on top either by feeding the right forms of words to the target string, or making your own string.Format with more specific slots specifying grammatical cases / conjugations. For instance in German:

    textMesh.text = MyString.Format("{0: DefNom} hat {1: DefDat} {2:UndefAcc} gegeben,
    casesManager.GetNounCase("De", "Hero", "DefNom"),
    casesManager.GetNounCase("De", "Princess", "DefDat"),
    casesManager.GetNounCase("De", "Flower", "UndefAcc"));


    // Der Held hat der Prinzessin eine Blume gegeben. (The hero has given the princess a flower.)


    In such case however you might replace the "slotting" process with a simple convention. Just tell the translating people that the same entity must have the same name everywhere. It's harder to maintain, and it won't work in all the cases of dynamic string generation, but it's simpler to implement.

    Localization is a bitch.
     
    Last edited: Dec 11, 2014
    NiklasBorglund likes this.
  37. jonrod29

    jonrod29

    Joined:
    Dec 4, 2014
    Posts:
    11
    Wow, I admit, I didn't know all that ^^' thanks a lot, I managed to do what I wanted with your explications :D
    I see this must be hard to use with all languages, luckily I limit myself to english and french for now so I shouldn't have any problem.
    Thanks again for your answer :)

    I just switched the platform for web player and I got the following error:
    "VerificationException: Error verifying SmartLocalization.LocalizedObject:GetLocalizedObjectType (string): Object not compatiblewith constrained type a 0x0020"

    Don't know if that can help to see where my problem is ><"
     
    Last edited: Dec 8, 2014
  38. jonrod29

    jonrod29

    Joined:
    Dec 4, 2014
    Posts:
    11
    Sorry about the double posting. I have another information about my problem : it seems I cannot use the Smart Localization window when I'm on the web player" platform. For instance, I click on "Edit Root Language File", and I have the same exception that I posted above. I post all the details if that can help:
    I can't find the solution TT

    VerificationException: Error verifying SmartLocalization.LocalizedObject:GetLocalizedObjectType (string): Object not compatible with constrained type at 0x0020
    SmartLocalization.LanguageParser.ReadData (System.Xml.XmlReader reader, System.Collections.Generic.SortedDictionary`2 loadedLanguageDB)
    SmartLocalization.LanguageParser.ReadElements (System.Xml.XmlReader reader, System.Collections.Generic.SortedDictionary`2 loadedLanguageDB)
    SmartLocalization.LanguageParser.LoadLanguage (System.String languageData)
    SmartLocalization.Editor.LanguageHandlerEditor.LoadParsedLanguageFile (System.String languageCode, Boolean isRoot)
    SmartLocalization.Editor.SmartLocalizationWindow.OnRootEditClick ()
    SmartLocalization.Editor.SmartLocalizationWindow.DrawAvailableLanguageItem (Rect position, SmartLocalization.SmartCultureInfo info)
    SmartLocalization.ReorderableList.GenericListAdaptor`1[T].DrawItem (Rect position, Int32 index)
    SmartLocalization.Editor.SmartCultureInfoListAdaptor.DrawItem (Rect position, Int32 index)
    SmartLocalization.ReorderableList.ReorderableListControl.DrawListItem (EventType eventType, Rect position, IReorderableListAdaptor adaptor, Int32 itemIndex)
    SmartLocalization.ReorderableList.ReorderableListControl.DrawListContainerAndItems (Rect position, Int32 controlID, IReorderableListAdaptor adaptor)
    SmartLocalization.ReorderableList.ReorderableListControl.DrawLayoutListField (Int32 controlID, IReorderableListAdaptor adaptor)
    SmartLocalization.ReorderableList.ReorderableListControl.Draw (Int32 controlID, IReorderableListAdaptor adaptor, SmartLocalization.ReorderableList.DrawEmpty drawEmpty)
    SmartLocalization.ReorderableList.ReorderableListControl.Draw (IReorderableListAdaptor adaptor)
    SmartLocalization.Editor.SmartLocalizationWindow.ShowCreatedLanguages ()
    SmartLocalization.Editor.SmartLocalizationWindow.OnGUI ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
     
  39. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262

    Thanks for the Exception log. I'll look into it. Are you using 4.6?
     
  40. jonrod29

    jonrod29

    Joined:
    Dec 4, 2014
    Posts:
    11
    Yes, I'm using Unity 4.6. And it seems the exception appears on every project, I tried to create a new one with just your example scene, and I had the same problem.
     
  41. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Found the issue now. Apparently Unity doesn't like that we used ToString() on enums inside the dll:s. I removed all of that and it seems to work now.

    I've also submitted it to the store. PM me with your email if you want it before it gets approved.

    This issue is probably solved now. Same goes for you, PM me with your email if you want it before the store.
    Sorry for the delay on fixing this.

    Changelog 2.1005
    -----------------
    * Fixed VerificationException issues with the Web Player platform
    * Fixed issue with texture settings not being applied on localized textures
     
    RMagiko likes this.
  42. jonrod29

    jonrod29

    Joined:
    Dec 4, 2014
    Posts:
    11
    Hello there ! I tested the new version, it works perfectly with web player ! Thanks for the good work ! :D

    Although, I found another exception, when I use some sound in my game. I just imported a new sound in my scene, and whenever I handle it or launch the game with it, I got the following exception :

    VerificationException: Error verifying SmartLocalization.Editor.LocalizedKeySelector:SelectKeyGUI (string,bool,SmartLocalization.LocalizedObjectType): Object not compatible with constrained type at 0x00c0
    SmartLocalization.Editor.LocalizedAudioSourceInspector.OnInspectorGUI ()
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/BuildAgent/work/d63dfc6385190b60/Editor/Mono/Inspector/InspectorWindow.cs:1089)
    UnityEditor.DockArea:OnGUI()

    It's not a super serious issue because it doesn't cause any problem (at least I didn't see any for now) when playing, it's just spam the console with this exception.

    Good luck and thanks again for the good work !
     
  43. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Great :) Thanks for the exception log. We'll look into it.
     
  44. ts1812

    ts1812

    Joined:
    Dec 3, 2014
    Posts:
    3
    Hello

    First I would like to thank you for this plugin!.I'm developing a game with 4 languages and so far I found it very convenient to use .When I change the language everything works...
    however my problem is that my game is for mobile and the requirements are that the language will be determined by system language.

    My problem is that I always get English as system language.

    I tried running it in my computer(windows) on WP8,android,IOS ...in all of them I actually changed the system language. It.It should be mentioned the also the unity Application.systemLanguage return always English too.

    this is the function:


    private void SetLangauge()
    {
    try
    {
    _LanguageManager = LanguageManager.Instance;

    SmartCultureInfo systemCulture = LanguageManager.Instance.GetSupportedSystemLanguage();

    if (LanguageManager.Instance.IsLanguageSupported(systemCulture))
    {
    Debug.Log("supported");
    LanguageManager.Instance.ChangeLanguage(systemCulture.languageCode);

    }
    else
    {
    LanguageManager.Instance.IsLanguageSupported("en");
    }

    Debug.Log("System Culture : " + systemCulture.languageCode);
    SystemLanguage systemLanguage = Application.systemLanguage;
    Debug.Log("System Language : " + systemLanguage.ToString());
    }
    catch (Exception e)
    {
    Debug.Log(e.Message);
    }

    }
     
  45. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    Sure I can look into it. But if Application.systemLanguage always returns english - I doubt that there's much I can do, because that is how we get the system language. We only use Application.systemLanguage.

    If anyone else has this problem, please let us know.
     
  46. ts1812

    ts1812

    Joined:
    Dec 3, 2014
    Posts:
    3

    OK I made some progress...
    Actually the returned language is OK (I previously checked the returned string in only windows in Debug.Log - I created labels and checked on mobile so its OK)
    So I thought problem is in the change language - I checked this also it seem to be change
    The problem I think is in the Instance - While debugging - I see the language manager instance is changed(In a splash window scene), but in the Hierarchy(in the next scene) I have LanguageManager with "en" , I also want t to mention I have scenes where LanguageManager is created multiple times.(using it on NGUI labels with the provided script for NGUI labels) - so I guess there is issue with instances...

    Well as you see I'm using the instance to get current (Actually I don't see any other way...)

    Thank you
     
  47. Fowi

    Fowi

    Joined:
    Dec 2, 2013
    Posts:
    30
    Good S*** news.... I have translated 4 languages using Microsoft Azure Translation within Smart Localization. Now, I have Bad request 400 and Cannot find an active Azure Market Place Translator Subscription....
    Big S***.... :-D.... Then, if this continue, I will translate manually on the web, with Microsoft or Google.... but then Smart Localization has no sense. The (unique) power of Smart Localization is that, it translates phrases mass for other languages ... If now it can't do this, it is best to delete the S*** folder package of "Smart Localization" and do the same thing with the code of the classes of Unity itself (no more complicated, same code writing lines, but different code.)
     
  48. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    If you change the scene, the LanguageManager will be destroyed. Use this - to tell the system to not destroy the instance between scenes.

    When did it stop working? Did you translate all 4 languages recently(i.e. this month)? I doubt that if you exceeded the 2 million characters would give you that response, though.

    Anyhow, I usually get that error when I have the wrong credentials. Microsoft lets you authorize with your azure credentials and it will even let you translate a few times until it stops working.
    Did you create a registered application in the developer section in the azure marketplace? You need to do that if you haven't already.

    Hope that helps.
     
  49. Fowi

    Fowi

    Joined:
    Dec 2, 2013
    Posts:
    30
    Wow, now it works... I needed to register an application and put the correct client secret... (BUT BEFORE! I could translate up to 4 languages, using my Key Master Account as a client secret.... I could translate using a wrong way, then thought it was correct....)... Sorry for my words. Awesome package 0:->
     
  50. NiklasBorglund

    NiklasBorglund

    Joined:
    Feb 9, 2012
    Posts:
    262
    I'm glad it works :)

    Yeah, Microsoft lets you translate a few sentences with your master account credentials without any errors. Don't know why - seems a bit counter-intuitive.