6.6.7 • Published 3 years ago

io.nekonya.tinax.i18n v6.6.7

Weekly downloads
45
License
MIT
Repository
-
Last release
3 years ago

TinaX Framework - Internationalization (I18N).

LICENSE LICENSE

TinaX is a Unity-based framework, simple , complete and delightful, ready to use. TinaX provides functionality in the form of "Unity packages".

TinaX.I18N provides internationalization feature support for TinaX Framework

  • Use json (or .asset file) key/value to define the i18n table
  • Real-time regions switching
  • Extensions for UGUI.

package name: io.nekonya.tinax.i18n

"Readme" in other languages :


QuickStart

The main service interface of VFS:

TinaX.I18N.II18N

Facade of the main service interface:

TinaX.I18N.XI18N

Define some json file:

en_common.json

{
    "data":[
        { "k": "hello", "v" : "Hello"   },
        { "k": "meow",  "v" : "Meow~"   }
    ]
}

jp_common.json

{
    "data":[
        { "k": "hello",   "v" : "こんいちは"},
        { "k": "meow" ,   "v" : "にゃ"     }
    ]
}

The Json file is suitable for slightly larger projects. Usually in these projects, the I18N definition file will be configured by Excel and exported to Json through the tools in the team.

For small-scale projects, Json seems too cumbersome, it is recommended to directly use the form of .asset file to configure the data.

Then configure the above json file in the corresponding area in the "Project Settings" window.

Use I18N text in code.

gameObject.GetComponent<Text>().text = i18n.GetText("hello");
//The object "i18n" (type: II18N) can be obtained through dependency injection. or use facade.

For scenes that do not require coding, you can also use Component to set Text directly.

1592018075032

Most functions of TinaX are based on URI to management assets, such as pictures, audio, Prefabs, etc. This means that almost all functions can provide localized services through the i18n system in the form of key/value table.

For other usages, please read the documentation.


Install this package

Install via openupm

# Install openupm-cli if not installed.
npm install -g openupm-cli
# OR yarn global add openupm-cli

#run install in your project root folder
openupm add io.nekonya.tinax.i18n

Install via npm (UPM)

Modify Packages/manifest.json file in your project, and add the following code before "dependencies" node of this file:

"scopedRegistries": [
    {
        "name": "TinaX",
        "url": "https://registry.npmjs.org",
        "scopes": [
            "io.nekonya"
        ]
    },
    {
        "name": "package.openupm.com",
        "url": "https://package.openupm.com",
        "scopes": [
            "com.cysharp.unitask",
            "com.neuecc.unirx"
        ]
    }
],

If after doing the above, you still cannot find the relevant Packages for TinaX in the "Unity Package Manager" window, You can also try refreshing, restarting the editor, or manually adding the following configuration to "dependencies" node.

"io.nekonya.tinax.i18n" : "6.6.1"

Install via git UPM:

You can use the following to install and use this package in UPM GUI.

git://github.com/yomunsam/TinaX.I18N.git

If you want to set a target version, you can use release tag like #6.6.3. for detail you can see this page: https://github.com/yomunsam/TinaX.I18N/releases

Dependencies

if you install packages by git UPM, You need to install the dependencies manually. Or dependencies will installed automatically by NPM / OpenUPM


Learn TinaX

You can find out how to use the various features of TinaX in the documentation


Third-Party

The following excellent third-party libraries are used in this project:

  • UniRx : Reactive Extensions for Unity