Skip to content

Commit

Permalink
Add API I18NBundle#keys() (libgdx#7068)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebnbin authored Feb 2, 2023
1 parent 4b1ca87 commit 8936a8a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
16 changes: 16 additions & 0 deletions gdx/src/com/badlogic/gdx/utils/I18NBundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<String> keys () {
Set<String> result = new LinkedHashSet<>();
ObjectMap.Keys<String> 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.
*
Expand Down

0 comments on commit 8936a8a

Please sign in to comment.