From 8936a8a3f4a30ca4260fd65eaa38ce96f85aa9e2 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 2 Feb 2023 13:54:34 -0500 Subject: [PATCH] Add API I18NBundle#keys() (#7068) --- CHANGES | 1 + gdx/src/com/badlogic/gdx/utils/I18NBundle.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGES b/CHANGES index 662650b4652..429470d1744 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ - LWJGL3 Fix: Stereo audio can now be played on mono output devices. This may also improve downmixing to stereo and upmixing to surround. - API Addition: Added CheckBox#getImageDrawable. - FIX: HexagonalTiledMapRenderer now displays maps with the correct stagger index. +- API Addition: Added I18NBundle#keys() method. - TOOLS Features: Save mode can be changed in Flame particle 3D editor. [1.11.0] diff --git a/gdx/src/com/badlogic/gdx/utils/I18NBundle.java b/gdx/src/com/badlogic/gdx/utils/I18NBundle.java index 859fc8a7062..4beb8adbd38 100644 --- a/gdx/src/com/badlogic/gdx/utils/I18NBundle.java +++ b/gdx/src/com/badlogic/gdx/utils/I18NBundle.java @@ -19,9 +19,11 @@ import java.io.IOException; import java.io.Reader; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.MissingResourceException; +import java.util.Set; import com.badlogic.gdx.files.FileHandle; @@ -440,6 +442,20 @@ public String get (String key) { return result; } + /** Gets a key set of loaded properties. Keys will be copied into a new set and returned. + * + * @return a key set of loaded properties. Never null, might be an empty set */ + public Set keys () { + Set result = new LinkedHashSet<>(); + ObjectMap.Keys keys = properties.keys(); + if (keys != null) { + for (String key : keys) { + result.add(key); + } + } + return result; + } + /** Gets the string with the specified key from this bundle or one of its parent after replacing the given arguments if they * occur. *