How to use

Setup

  1. Import BGLocalization package
  2. Create your own database ( more info). Choose Resources or StreamingAssets loader for your database.
  3. Enable localization addon
  4. Go to Database->Localization and add your locales. Locale name - letters only, 8 chars maximum.
    Note, locales is just a regular table, so you can add your own fields, like native spelling, flag icons etc.
  5. Please, for adding/deleting locales use our GUI only, do not use external tools like Excel/GoogleSheets

Setup single value table

Single value table is easy to use, but can have only one field.

  1. Go to Configuration and create a table (type of the table is LocalizationSingleValue), choose the type of data to be stored.
  2. Go to Database->"Your created table", add some rows. You can edit values for all locales here. Also, you can use machine translation (Learn more about auto-translation here)

Setup embedded fields

Embedded fields allow you to embed localization fields into normal rows along with other fields and require more actions.

  1. Go to Configuration and create a table for your locale data (type of the table is Localization), choose the type of data to be stored.
  2. Create a normal table (row)
  3. Add a localized field to this table. You will need to choose a related table (created at step 1) here
  4. Go to Database->"Your created table", add some rows. You can edit localized values here (current locale will be used)
  5. Another option - is to choose "localization" table and edit values for all locales at once. You can use Auto-translation here
  6. Learn more about auto-translation here
  7. Once your data is ready, you can localize your Components (any field or property). For more details, please read the following section

How to localize fields/properties

More details about data binding can be found here

If you need to localize single field/property using single cell value from database, use BGDataBinderFieldGo component (or legacy BGLocalizationGo)

If you need to use text template, use BGDataBinderTemplateGo component (or use a graph binder ↓ )

If you need to calculate a final value to inject - use a graph-based binder

If you want to localize multiple fields/properties from multiple GameObjects with single component, use BGDataBinderBatchGo component

Localization add-on adds the following features to data binding:

  1. For single value localization, it adds special $locale field, if your meta has localizationSingleValue type
  2. For templates, you can also use $locale as field name, if your meta has localizationSingleValue type
  3. For graph binder it adds get/set locale units and special "GetLocalizeValue" for each single value localization table

How to change locale


    // method #1
    BGAddonLocalization.DefaultRepoCurrentLocale = "en"; // replace en with your locale name

    // method #2
    var addon = BGRepo.I.Addons.Get<BGAddonLocalization>();
    addon.CurrentLocale = "en"; // replace en with your locale name

Example project

Example project is available for download here