From 02dd2813953602e0daced8a62168c191270a1d33 Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Sat, 3 Feb 2018 13:28:28 -0800 Subject: [PATCH] -Added display name to subtitles that resolves language code into locale. --- src/main/java/org/schabi/newpipe/extractor/Subtitles.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/schabi/newpipe/extractor/Subtitles.java b/src/main/java/org/schabi/newpipe/extractor/Subtitles.java index bb5fd919b..dd0b94407 100644 --- a/src/main/java/org/schabi/newpipe/extractor/Subtitles.java +++ b/src/main/java/org/schabi/newpipe/extractor/Subtitles.java @@ -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 : ""); + } }