NeutralResourcesLanguageAttribute.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Resources
  5. {
  6. [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
  7. public sealed class NeutralResourcesLanguageAttribute : Attribute
  8. {
  9. public NeutralResourcesLanguageAttribute(string cultureName)
  10. {
  11. if (cultureName == null)
  12. throw new ArgumentNullException(nameof(cultureName));
  13. CultureName = cultureName;
  14. Location = UltimateResourceFallbackLocation.MainAssembly;
  15. }
  16. public NeutralResourcesLanguageAttribute(string cultureName, UltimateResourceFallbackLocation location)
  17. {
  18. if (cultureName == null)
  19. throw new ArgumentNullException(nameof(cultureName));
  20. if (!Enum.IsDefined(typeof(UltimateResourceFallbackLocation), location))
  21. throw new ArgumentException(SR.Format(SR.Arg_InvalidNeutralResourcesLanguage_FallbackLoc, location));
  22. CultureName = cultureName;
  23. Location = location;
  24. }
  25. public string CultureName { get; }
  26. public UltimateResourceFallbackLocation Location { get; }
  27. }
  28. }