mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
more dynamic bundles
GitOrigin-RevId: 287684f806e29937f08580dfe89f478f170fb32b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
67d3dd990b
commit
da81ff4937
@@ -15,36 +15,24 @@
|
||||
*/
|
||||
package com.intellij.openapi.application;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.DynamicBundle;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.PropertyKey;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Provides access to localized properties of the IntelliJ Platform.
|
||||
*/
|
||||
public class ApplicationBundle {
|
||||
|
||||
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
|
||||
return CommonBundle.message(getBundle(), key, params);
|
||||
}
|
||||
|
||||
private static Reference<ResourceBundle> ourBundle;
|
||||
public class ApplicationBundle extends DynamicBundle {
|
||||
@NonNls public static final String BUNDLE = "messages.ApplicationBundle";
|
||||
private static final ApplicationBundle INSTANCE = new ApplicationBundle();
|
||||
|
||||
private ApplicationBundle() {
|
||||
super(BUNDLE);
|
||||
}
|
||||
|
||||
private static ResourceBundle getBundle() {
|
||||
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
|
||||
if (bundle == null) {
|
||||
bundle = ResourceBundle.getBundle(BUNDLE);
|
||||
ourBundle = new SoftReference<>(bundle);
|
||||
}
|
||||
return bundle;
|
||||
@NotNull
|
||||
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
|
||||
return INSTANCE.getMessage(key, params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user