banner
Rating
Voted0

SubtitlesAPI

0
Mod version:1
Game version:0.0.6
The mod has been successfully tested for the absence of viruses
1749.29K21.4K

Report mod

  • image
modalImage

About This Mod

Caption API

Central API for getting localized subtitles.


Feedback.

If you have feedback, please post it on Github Issues!


Use.

If you are creating a mod and want to add subtitles for custom sounds, it's very simple! Simply add a .dll fashion file to the link to your project and add the following code:


Static SubtitlesAPI.SubtitlesAPI;


try.

{

 Localisation.AddTranslation(«CustomSound», «Custom Subtitles»);

}

Catch.

{

 Debug.Log("SubtitlesAPI mode not found"); }

}

There is no need to even ask the player to use this mode!


Methods.

SubtitlesAPI.Localization.AddTranslation(string soundFileName, string subtitleText);

SubtitlesAPI.Localisation.AddTranslation(Dictionary<string, string>);

Dictionary<string, string> is a dictionary that contains Key: soundFileName, Value: subtitleText.

SubtitlesAPI.Localisation.AddDialogueTranslation(string sound, List<(float, string)> subtitles);

SubtitlesAPI.Localisation.AddDialogueTranslation(Dictionary<string, List<(float, string)>> translationsToAdd);

where Dictionary<string, List<(float, string)>> is a dictionary with Key: soundFileName and Value: subtitles.

This method returns a boolean dictionary value or a list of boolean values.


The result will be true if the mod was able to add subtitles, or false if not. Other mods can have the same audio file name.


Contribution.

Do you want to add or change captions? Want to create new locales for other languages? Do it! Fork this repository, make your add-ons or changes there, and submit a repair request.


Additional subtitles

Open the locale you want to edit (for example, EnglishSubtitleLocalisation.cs) and add it to the dictionary!


SubtitleAPI.localisation. Translation

The dictionary will use the following format for new entries:


{ 'SoundFileName' , 'Subtitle to Add' }

SubtitlesAPI.Localisation.DialogueTranslations

The dictionary uses the following format for new entries:


{

 F0DaysLeftAlert»,

 new()

 {

  (0, "[Company jingle sounds]"),

  (4.969f, "Immediately report to the company office"),

  (7.189f, "scrap metal sales, etc."),

  (9.758f, "You have 0 days to reach your profit quota"),

  (13.085f), "You can use the terminal for routing",

  (14.874f, "We go to the company building on autopilot"), (14.874f, "We go to the company building on autopilot") }

 }

}, }

{ }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, and New Locale.

To create a new locale, simply add a new file to the Locale folder, change Locale to the locale you want to add using the ISubtitleLocalisation interface, and add the translation to the dictionary!


Sample locale

public class EnglishSubtitleLocalization : ISubtitleLocalisation

{

 public string Locale => «en»;


 public Dictionary<string, string> Translations => new(StringComparer.OrdinalIgnoreCase) {

  { "AirHorn1", "Air Horn Player" }

 }


 public Dictionary<string, List<(float, string)>> DialogueTranslations => new(StringComparer.OrdinalIgnoreCase)

  {

   {

    «F0DaysLeftAlert»,

    new()

    {

     (0, "[plays jingle company]"),

     (4.969f, "Immediately enter the company"),

     (7.189f, "scrap metal sales, etc."),

     (9.758f, "You have 0 days to reach your profit quota"),

     (13.085f), "You can use the terminal for routing",

     (14.874f, "We go to the company building on autopilot"), (14.874f, "We go to the company building on autopilot") }

    }

   },

  };

}

Similar Mods/Addons

Game Version *

0.0.6 (JustJelly-SubtitlesAPI-0.0.6.zip)