Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ jobs:
- name: Verify Git tags for MinVer
run: |
git fetch --tags --force
git describe --tags
git tag --points-at HEAD
echo "Checking for tags..."
git describe --tags 2>/dev/null || echo "No tags found yet - this is expected for first release"
git tag --points-at HEAD || echo "No tag at current commit"

- name: Restore dependencies
run: dotnet restore
Expand Down
14 changes: 10 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>

<!-- Core Libraries (for .NET Standard support) -->
<ItemGroup>
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<!-- Microsoft Extensions -->
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
</ItemGroup>

<!-- Testing Packages -->
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.4" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="FluentAssertions" Version="7.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Target Frameworks - Modern .NET -->
<TargetFrameworks>netstandard2.1;net8.0;net9.0;net10.0</TargetFrameworks>
<!-- Target Frameworks - Broad compatibility (.NET Standard 2.0 works with .NET Framework 4.6.1+, .NET Core 2.0+, Unity, Xamarin) -->
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net10.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -46,7 +46,8 @@ Initial release v1.0.0:
- AddCountryData() extension method
- Singleton lifetime management for ICountryDataProvider
- Full ASP.NET Core integration support
- Multi-framework support (.NET Standard 2.1, .NET 8-10)
- Multi-framework support (.NET Standard 2.0+, .NET 6, 8, 10)
- Works with .NET Framework 4.6.1+, .NET Core 2.0+, Unity, Xamarin
</PackageReleaseNotes>

<!-- Package Icon (uncomment when you add an icon) -->
Expand Down
10 changes: 6 additions & 4 deletions src/CountryData.Globalization/CountryData.Globalization.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Target Frameworks - Modern .NET -->
<TargetFrameworks>netstandard2.1;net8.0;net9.0;net10.0</TargetFrameworks>
<!-- Target Frameworks - Broad compatibility (.NET Standard 2.0 works with .NET Framework 4.6.1+, .NET Core 2.0+, Unity, Xamarin) -->
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net10.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -49,8 +49,9 @@ Initial release v1.0.0:
- Full CultureInfo and RegionInfo integration
- O(1) dictionary lookups with lazy-loaded caches
- Thread-safe operations with immutable data collections
- Zero external dependencies
- Multi-framework support (.NET Standard 2.1, .NET 8-10)
- Minimal external dependencies (only System.Text.Json)
- Multi-framework support (.NET Standard 2.0+, .NET 6, 8, 10)
- Works with .NET Framework 4.6.1+, .NET Core 2.0+, Unity, Xamarin
- Built-in dependency injection support via CountryData.Globalization.Hosting package
</PackageReleaseNotes>

Expand Down Expand Up @@ -97,6 +98,7 @@ Initial release v1.0.0:

<!-- Package References from Central Package Management -->
<ItemGroup>
<PackageReference Include="System.Text.Json" />
<PackageReference Include="MinVer" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/CountryData.Globalization/Models/Country.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
{
/// <summary>
/// Represents a country with its associated data including ISO codes, names, phone codes, regions, and Unicode emoji flag.
///
///
/// </summary>
public class Country
{
/// <summary>
/// Gets or sets the full country name (e.g., "United States", "Canada", "Japan").
/// </summary>
public required string CountryName { get; set; }
public string CountryName { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the international phone code for the country (e.g., "+1", "+44", "+81").
/// </summary>
public required string PhoneCode { get; set; }
public string PhoneCode { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the ISO 3166-1 alpha-2 country code (e.g., "US", "CA", "JP").
/// </summary>
public required string CountryShortCode { get; set; }
public string CountryShortCode { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the Unicode emoji flag representing the country (e.g., "🇺🇸", "🇨🇦", "🇯🇵").
Expand Down
2 changes: 1 addition & 1 deletion src/CountryData.Globalization/Models/Region.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Region
/// <summary>
/// Gets or sets the full region name (e.g., "California", "Ontario", "Tokyo").
/// </summary>
public required string Name { get; set; }
public string Name { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the region short code (e.g., "CA", "ON", "13").
Expand Down
12 changes: 11 additions & 1 deletion src/CountryData.Globalization/Services/CountryDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,17 @@ public IEnumerable<CultureInfo> GetAllCulturesForCountry(string shortCode)
try
{
var cultureName = $"{languageCode}-{shortCode}";
return CultureInfo.GetCultureInfo(cultureName);
var culture = CultureInfo.GetCultureInfo(cultureName);

// Validate that the culture actually exists in the system
// This ensures consistent behavior across Windows/Linux
var allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
if (!allCultures.Any(c => c.Name.Equals(cultureName, StringComparison.OrdinalIgnoreCase)))
{
return null;
}

return culture;
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
<PackageReference Include="coverlet.collector" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading