You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of the current version (April 28 2019), we start with an English (or whatever language, I guess) SRT file. The file is converted to JSON so we can interact with the file programatically.
Line breaks from the source SRT file are converted to \n in the JSON file cause JSON, and when the program goes to translate the captions, we pull the line break because obviously \n won't translate. Gotta figure out a way to add them back though.
@kpmgeek mentioned that in America, the standard for each line in an SRT file is 32 characters, but other countries are more lenient with their standards. I think we can just count up to 32 characters, and if there's a character that is not a space (i.e: a letter, number, etc), we move back to the nearest space and insert a line break there.
However, this isn't necessarily the best approach because sometimes on the first line you have things like [Narrator] and then the second line is what the narrator is saying, so we need to find a way around that & also find a way around leaving one word/character/whatever on the 2nd line with everything else up top. Maybe count the total characters for the caption (between 1-2 lines), then count all the spaces in that caption, subtract the number of spaces from the number of total characters and divide that number by 2?
Example Caption: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et maximus dolor.
Total Length - 80 characters
Number of spaces - 9 spaces (80 - 9) / 2 = 35.5
I don't know where I'm going with that, but you get what I mean.
The text was updated successfully, but these errors were encountered:
As of the current version (April 28 2019), we start with an English (or whatever language, I guess) SRT file. The file is converted to JSON so we can interact with the file programatically.
Line breaks from the source SRT file are converted to
\n
in the JSON file cause JSON, and when the program goes to translate the captions, we pull the line break because obviously\n
won't translate. Gotta figure out a way to add them back though.@kpmgeek mentioned that in America, the standard for each line in an SRT file is 32 characters, but other countries are more lenient with their standards. I think we can just count up to 32 characters, and if there's a character that is not a space (i.e: a letter, number, etc), we move back to the nearest space and insert a line break there.
However, this isn't necessarily the best approach because sometimes on the first line you have things like
[Narrator]
and then the second line is what the narrator is saying, so we need to find a way around that & also find a way around leaving one word/character/whatever on the 2nd line with everything else up top. Maybe count the total characters for the caption (between 1-2 lines), then count all the spaces in that caption, subtract the number of spaces from the number of total characters and divide that number by 2?Example Caption:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et maximus dolor.
Total Length -
80 characters
Number of spaces -
9 spaces
(80 - 9) / 2 = 35.5
I don't know where I'm going with that, but you get what I mean.
The text was updated successfully, but these errors were encountered: