forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Simplified implementation of MRT Core
ResourceLoader
- Loading branch information
1 parent
d83f220
commit ec0dc35
Showing
3 changed files
with
277 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Uno.UI/Microsoft/Windows/ApplicationModel/Resources/ResourceLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using WinRTResourceLoader = global::Windows.ApplicationModel.Resources.ResourceLoader; | ||
|
||
namespace Microsoft.Windows.ApplicationModel.Resources; | ||
|
||
/// <summary> | ||
/// Provides simplified access to app resources such as app UI strings. | ||
/// </summary> | ||
public partial class ResourceLoader | ||
{ | ||
private readonly WinRTResourceLoader _resourceLoader; | ||
|
||
/// <summary> | ||
/// Constructs a new ResourceLoader object for the "Resources" subtree of the currently running app's main ResourceMap. | ||
/// </summary> | ||
public ResourceLoader() => _resourceLoader = new(); | ||
|
||
/// <summary> | ||
/// Constructs a new ResourceLoader object for the specified ResourceMap. | ||
/// </summary> | ||
/// <param name="fileName"> | ||
/// The resource identifier of the ResourceMap that the new resource loader | ||
/// uses for unqualified resource references. It can then retrieve resources | ||
/// relative to those references. | ||
/// </param> | ||
public ResourceLoader(string fileName) => _resourceLoader = new(fileName); | ||
|
||
/// <summary> | ||
/// Returns the most appropriate string value of a resource, specified by resource identifier. | ||
/// </summary> | ||
/// <param name="resourceId">The resource identifier of the resource to be resolved.</param> | ||
/// <returns>The most appropriate string value of the specified resource for the default ResourceContext.</returns> | ||
public string GetString(string resourceId) => _resourceLoader.GetString(resourceId); | ||
} |
Oops, something went wrong.