[Android] Use the VLC locale substitution workflow for media info and Video stats

Nicolas Pomepuy git at videolan.org
Tue Nov 2 13:10:20 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Oct 14 13:52:48 2021 +0200| [1e166548a69d8fc4e212a2b39bdf03a1840658ec] | committer: Nicolas Pomepuy

Use the VLC locale substitution workflow for media info and Video stats

> https://code.videolan.org/videolan/vlc-android/commit/1e166548a69d8fc4e212a2b39bdf03a1840658ec
---

 .../vlc-android/src/org/videolan/vlc/gui/video/MediaInfoAdapter.kt     | 3 ++-
 .../vlc-android/src/org/videolan/vlc/gui/video/VideoStatsDelegate.kt   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoAdapter.kt
index 1415fcb53..8bb3214cc 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoAdapter.kt
@@ -29,6 +29,7 @@ import androidx.recyclerview.widget.RecyclerView
 import org.videolan.libvlc.interfaces.IMedia
 import org.videolan.tools.readableSize
 import org.videolan.vlc.R
+import org.videolan.vlc.util.LocaleUtil
 
 class MediaInfoAdapter : RecyclerView.Adapter<MediaInfoAdapter.ViewHolder>() {
     private lateinit var inflater: LayoutInflater
@@ -80,7 +81,7 @@ class MediaInfoAdapter : RecyclerView.Adapter<MediaInfoAdapter.ViewHolder>() {
             textBuilder.append(res.getString(R.string.track_bitrate_info, track.bitrate.toLong().readableSize()))
         textBuilder.append(res.getString(R.string.track_codec_info, track.codec))
         if (track.language != null && !track.language.equals("und", ignoreCase = true))
-            textBuilder.append(res.getString(R.string.track_language_info, track.language))
+            textBuilder.append(res.getString(R.string.track_language_info, LocaleUtil.getLocaleName(track.language)))
     }
 
     private fun appendAudio(textBuilder: StringBuilder, res: Resources, track: IMedia.AudioTrack) {
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoStatsDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoStatsDelegate.kt
index f7fd7a392..3b7460b59 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoStatsDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoStatsDelegate.kt
@@ -47,6 +47,7 @@ import org.videolan.tools.readableSize
 import org.videolan.vlc.BuildConfig
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.PlayerHudBinding
+import org.videolan.vlc.util.LocaleUtil
 import org.videolan.vlc.util.getScreenWidth
 import java.lang.Double
 
@@ -119,7 +120,7 @@ class VideoStatsDelegate(private val player: VideoPlayerActivity, val scrolling:
                 if (track.bitrate > 0) addStreamGridView(grid, player.getString(R.string.bitrate), player.getString(R.string.bitrate_value, track.bitrate.toLong().readableSize()))
                 addStreamGridView(grid, player.getString(R.string.codec), track.codec)
                 if (track.language != null && !track.language.equals("und", ignoreCase = true))
-                    addStreamGridView(grid, player.getString(R.string.language), track.language)
+                    addStreamGridView(grid, player.getString(R.string.language), LocaleUtil.getLocaleName(track.language))
 
                 when (track.type) {
                     IMedia.Track.Type.Audio -> {



More information about the Android mailing list