• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Auros/SiraLocalizer: Community localization support in Beat Saber.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Auros/SiraLocalizer

开源软件地址(OpenSource Url):

https://github.com/Auros/SiraLocalizer

开源编程语言(OpenSource Language):

C# 100.0%

开源软件介绍(OpenSource Introduction):

SiraLocalizer

Community localization support in Beat Saber. Created by nicoco007 and Auros.

Requires SiraUtil 2.1.0 or greater.

Supported Languages for the Base Game

The community has unofficially translated the base game into the following languages:

  • Chinese (Simplified)
  • French
  • German
  • Italian
  • Korean
  • Portuguese (Brazilian)
  • Russian

See CONTRIBUTORS for a list of everyone who has helped make SiraLocalizer possible!

You can change the language in-game by going to Options > Settings > Others. Localization Location

Becoming a Translator

See CONTRIBUTING.

Using SiraLocalizer in Your Mod

Modders can implement localizations into their own mods as well. Requires SiraUtil and some very basic knowledge of Zenject. Check out SiraUtil's README for more information.

Creating a Localization Sheet

Create a copy of the Polyglot Template Google Sheet, erase all the keys that are there (starting at line 7 then all the way down), and add your own instead. Do not delete any of the columns even if you don't plan on supporting that language because Polyglot expects the specific order of languages used in the sheet.

Retrieving and Using an ILocalizer Instance

You can get access to an ILocalizer instance by injecting it into a class. The example below uses constructor injection and Zenject's IInitializable interface. Note that you must use the [InjectOptional] attribute.

internal class MyLocalizationHandler : IInitializable
{
    private readonly ILocalizer _localizer;

    internal MyLocalizationHandler([InjectOptional(Id = "SIRA.Localizer")] ILocalizer localizer)
    {
        _localizer = localizer;
    }

    public void Initialize()
    {
        _localizer?.AddLocalizationSheetFromAssembly("YourAssemblyPath.ToThe.Localization.sheet.csv", GoogleDriveDownloadFormat.CSV);
    }
}

The ILocalizer interface is located in SiraUtil. This means you can add full localization support to your mod without having to depend on the SiraLocalizer mod.

Other Goodies

A useful extension method for strings exists in SiraUtil...

myLocalizedText = "MY_MOD_LOCALIZATION_KEY".LocalizationGetOr("My Localized Text");

This will run the key through Polyglot, and if it does not exist for the current language, return the string in the parameter.

Shadow Localizations

When calling .AddLocalizationSheet methods you can specify a parameter called shadow. Setting this to true will make that sheet a shadow sheet, and your localizations for a specific language will not show unless another sheet exists that has localizations for that same specific language is NOT marked as a shadow sheet. This is to prevent one mod having a large number of localizations for different languages "bloating" the language selection list.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap