Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subdivisions project #33

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions src/Nager.Country.Subdivision/EmptySubdivisionTranslation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Nager.Country.Translation;

namespace Nager.Country.Subdivision;

public class EmptySubdivisionTranslation : ISubdivisionTranslation
{
public TranslationInfo[] Translations => [];
}
21 changes: 21 additions & 0 deletions src/Nager.Country.Subdivision/ISubdivisionInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Nager.Country.Subdivision;

public interface ISubdivisionInfo
{
/// <summary>
/// CommonName (english)
/// </summary>
string CommonName { get; }
/// <summary>
/// ISO-3166-2 code
/// </summary>
string TextCode { get; }
/// <summary>
/// Subdivision code
/// </summary>
SubdivisionCode Code { get; }
/// <summary>
/// Alpha2Code of parent
/// </summary>
Alpha2Code ParentAlpha2Code { get; }
}
10 changes: 10 additions & 0 deletions src/Nager.Country.Subdivision/ISubdivisionProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Nager.Country.Subdivision;

public interface ISubdivisionProvider
{
IEnumerable<ISubdivisionInfo> GetSubdivisions();
IEnumerable<ISubdivisionInfo> GetSubdivisions( Alpha2Code alpha2Code );
IEnumerable<ISubdivisionInfo> GetSubdivisions( Alpha3Code alpha3Code );

ISubdivisionInfo GetSubdivision( SubdivisionCode code );
}
14 changes: 14 additions & 0 deletions src/Nager.Country.Subdivision/ISubdivisionTranslation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Nager.Country.Translation;

namespace Nager.Country.Subdivision;

/// <summary>
/// ISubdivisionTranslation
/// </summary>
public interface ISubdivisionTranslation
{
/// <summary>
/// Get all subdivision translation (different than common name)
/// </summary>
TranslationInfo[] Translations { get; }
}
12 changes: 12 additions & 0 deletions src/Nager.Country.Subdivision/ISubdivisionTranslationProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Nager.Country.Translation;

namespace Nager.Country.Subdivision;

public interface ISubdivisionTranslationProvider
{
ISubdivisionTranslation GetSubdivisionTranslation( SubdivisionCode code );

string GetSubdivisionTranslatedName( SubdivisionCode code, LanguageCode languageCode );

string GetSubdivisionTranslatedOrCommonName( SubdivisionCode code, LanguageCode languageCode );
}
13 changes: 13 additions & 0 deletions src/Nager.Country.Subdivision/Nager.Country.Subdivision.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6;net48</TargetFrameworks>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Nager.Country.Translation\Nager.Country.Translation.csproj" />
<ProjectReference Include="..\Nager.Country\Nager.Country.csproj" />
</ItemGroup>

</Project>
Loading