-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 java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Subtitles implements Serializable {
|
||||
private final static String AUTO_GENERATED_TAG = " (auto-generated)";
|
||||
|
||||
private final SubtitlesFormat format;
|
||||
private final String languageCode;
|
||||
private final String URL;
|
||||
|
@ -30,4 +33,9 @@ public class Subtitles implements Serializable {
|
|||
public boolean isAutoGenerated() {
|
||||
return autoGenerated;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
final Locale locale = new Locale(languageCode.replace("-", "_"));
|
||||
return locale.getDisplayLanguage() + (isAutoGenerated() ? AUTO_GENERATED_TAG : "");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue