Skip to content

sjvc/Unity3D-ResourceManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

Unity3D-ResourceManager

Strings locatization for Unity using Android format.

Usage

  • Place your xml string files using Android syntax in Resources/Strings/values[-iso_code] folders.
    • Default folder should be named values.
    • Language specific folders should be named values-iso_language_code.
    • You can name the xml file as you wish
    • You can have as many xml files as you want in the same folder
    • You can use multiple Resource folders
  • Copy Assets folder in this repository to your project
  • Add ResouceManager.cs script to a GameObject in your scene
  • In your code, call ResourceManager.GetString(Strings.yourStringKey) to get your localized resource.

Composites

String concatenation generates garbage. In order to avoid it, instead of concatenate strings at runtime, you can create them on a file called composites.xml in Resources/Strings folder, using {{key}} to refer to an existing string key. So they can be used as any other string resource.

For example, if you have this strings.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello</string>
    <string name="how_are_you">How are you?</string>
</resources>

And this composites.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello_how_are_you">{{hello}}. {{how_are_you}}</string>
</resources>

Then, ResourceManager.GetString(Strings.helloHowAreYou) output will be: Hello. How are you?

About

Strings management for Unity using Android format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages