warzone2100 icon indicating copy to clipboard operation
warzone2100 copied to clipboard

Use .srt subtitles instead of the legacy format

Open mt3d opened this issue 3 years ago • 4 comments

In their current format, the subtitles are hard to edit or translate. They cannot be read by any subtitling software, and to adjust their timings you have to convert them manually to a common subtitling format back and forth. Moreover, if you want to break long sentences into several lines, each line will appear as a separate string in Crowdin, which makes translating them harder.

Example:

x y 49 54 ("Disease and famine claimed most of us")
x y 0 0 ("who had survived the nuclear strikes.")

To fix this, the game will now use the widely-used .srt format, and for translation, GNU's gettext will not be used anymore. Instead, the each file will be added separately to Crowdin.

Summary of the changes:

  • Add several auxiliary functions to keep the code of the parser short and clear. These are split(), crossPlatformGetLine(), and srtTimeToSeconds().
  • For each sequence, getSubtitleFile() will look for a subtitle file that match the current selected language, or will fall back to the English original.
  • The parser is written mostly in C++ to increase the readability, and a portion of the old C code was rewritten in C++ to avoid directly manipulating characters and memory, and the out-of-bound errors associated with this.

Remaining steps:

  • [x] Convert all old subtitles from .txt to .srt.
  • [x] Remove the old subtitles and strings from the .po files, and add the new files to crowdin.yml.

mt3d avatar Feb 18 '22 10:02 mt3d

Is there something wrong with this PR? @mt3d

berserkingyadis avatar Mar 05 '22 20:03 berserkingyadis

Is there something wrong with this PR? @mt3d

@berserkingyadis I made a mistake and accidentally deleted the branch. Anyway, everything is okay now. Thanks for asking.

mt3d avatar Mar 05 '22 20:03 mt3d