mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-13 05:40:34 +05:30
-Added display name to subtitles that resolves language code into locale.
This commit is contained in:
parent
502fd53cc4
commit
02dd281395
@ -3,8 +3,11 @@ package org.schabi.newpipe.extractor;
|
|||||||
import org.schabi.newpipe.extractor.stream.SubtitlesFormat;
|
import org.schabi.newpipe.extractor.stream.SubtitlesFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Subtitles implements Serializable {
|
public class Subtitles implements Serializable {
|
||||||
|
private final static String AUTO_GENERATED_TAG = " (auto-generated)";
|
||||||
|
|
||||||
private final SubtitlesFormat format;
|
private final SubtitlesFormat format;
|
||||||
private final String languageCode;
|
private final String languageCode;
|
||||||
private final String URL;
|
private final String URL;
|
||||||
@ -30,4 +33,9 @@ public class Subtitles implements Serializable {
|
|||||||
public boolean isAutoGenerated() {
|
public boolean isAutoGenerated() {
|
||||||
return autoGenerated;
|
return autoGenerated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDisplayName() {
|
||||||
|
final Locale locale = new Locale(languageCode.replace("-", "_"));
|
||||||
|
return locale.getDisplayLanguage() + (isAutoGenerated() ? AUTO_GENERATED_TAG : "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user