| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="TranslationCatalog.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System.Collections.Frozen; |
| | | 8 | | using System.Collections.Generic; |
| | | 9 | | using System.Collections.Immutable; |
| | | 10 | | using System.Resources; |
| | | 11 | | |
| | | 12 | | namespace MyNet.Globalization.Localization.Translation.Catalog; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Immutable implementation of <see cref="ITranslationCatalog"/>. |
| | | 16 | | /// </summary> |
| | | 17 | | /// <remarks> |
| | | 18 | | /// Initializes a new instance of the <see cref="TranslationCatalog"/> class. |
| | | 19 | | /// </remarks> |
| | | 20 | | /// <param name="resources">The registered translation resources.</param> |
| | | 21 | | internal sealed class TranslationCatalog(ImmutableDictionary<string, ResourceManager> resources) : ITranslationCatalog |
| | | 22 | | { |
| | 25 | 23 | | private readonly FrozenDictionary<string, ResourceManager> _resources = resources.ToFrozenDictionary(); |
| | | 24 | | |
| | | 25 | | /// <inheritdoc /> |
| | 996 | 26 | | public IReadOnlyDictionary<string, ResourceManager> Resources => _resources; |
| | | 27 | | |
| | | 28 | | /// <inheritdoc /> |
| | 0 | 29 | | public bool TryGetResource(string resourceKey, out ResourceManager resourceManager) => _resources.TryGetValue(resour |
| | | 30 | | } |
| | | 31 | | |