SmartCoreHub.Localization.SDK 2026.5.30.20

There is a newer version of this package available.
See the version list below for details.
dotnet add package SmartCoreHub.Localization.SDK --version 2026.5.30.20
                    
NuGet\Install-Package SmartCoreHub.Localization.SDK -Version 2026.5.30.20
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SmartCoreHub.Localization.SDK" Version="2026.5.30.20" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartCoreHub.Localization.SDK" Version="2026.5.30.20" />
                    
Directory.Packages.props
<PackageReference Include="SmartCoreHub.Localization.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SmartCoreHub.Localization.SDK --version 2026.5.30.20
                    
#r "nuget: SmartCoreHub.Localization.SDK, 2026.5.30.20"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SmartCoreHub.Localization.SDK@2026.5.30.20
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SmartCoreHub.Localization.SDK&version=2026.5.30.20
                    
Install as a Cake Addin
#tool nuget:?package=SmartCoreHub.Localization.SDK&version=2026.5.30.20
                    
Install as a Cake Tool

SmartCoreHub.Localization.SDK

SDK para consumo da SmartCoreHub.Localization.API com autenticacao por API Key.

Novidades da implementacao de cache

  • Cache opcional para GetCurrentLanguageAsync e GetByLanguageAsync
  • Quando Cache.Enabled = true, a primeira consulta usa ListResourcesAsync e armazena o resultado
  • Chamadas seguintes retornam do cache
  • Suporte a provider customizado via ICacheProvider
  • Operacoes de manutencao: InvalidateCacheAsync(key) e ClearCacheAsync()

Locale padrao (sem expor headers HTTP)

  • Configure DefaultLocale (ex.: "pt-BR") ou use DefaultRequestSettings com LocalizationSdkRequestOption.Locale.
  • O SDK mapeia internamente para o header HTTP correto (Accept-Language).
  • Se nenhum locale for informado, o SDK envia automaticamente a cultura atual da thread (CultureInfo.CurrentUICulture).

Requisitos

  • .NET 8.0+
  • Endpoint da Localization API
  • API Key valida

Instalacao

dotnet add package SmartCoreHub.Localization.SDK

Configuracao (DI)

using SmartCoreHub.Localization.SDK.Extensions;

builder.Services.AddLocalizationSdk(options =>
{
    options.BaseUrl = "https://api.smartcorehub.com";
    options.ApiKey = "SUA_API_KEY";
    options.Timeout = TimeSpan.FromSeconds(30);
    options.DefaultLocale = "pt-BR";
    options.Cache = new CacheOptions
    {
        Enabled = true,
        Ttl = TimeSpan.FromMinutes(10)
    };
});

Com DefaultRequestSettings (array tipado):

using SmartCoreHub.Localization.SDK.Configuration;

builder.Services.AddLocalizationSdk(options =>
{
    options.BaseUrl = "https://api.smartcorehub.com";
    options.ApiKey = "SUA_API_KEY";
    options.DefaultRequestSettings =
    [
        LocalizationSdkRequestSetting.Locale("pt-BR")
    ];
});

Com provider customizado:

builder.Services.AddLocalizationSdk(options =>
{
    options.BaseUrl = "https://api.smartcorehub.com";
    options.ApiKey = "SUA_API_KEY";
    options.Cache = new CacheOptions
    {
        Enabled = true,
        Provider = new MemoryCacheProvider(),
        Ttl = TimeSpan.FromMinutes(10)
    };
});

Uso com ILocalizationApiClient

using SmartCoreHub.Localization.SDK.Abstractions;

public sealed class MyService
{
    private readonly ILocalizationApiClient _client;

    public MyService(ILocalizationApiClient client)
    {
        _client = client;
    }

    public async Task<string?> GetCurrentAsync(CancellationToken ct)
    {
        return await _client.GetCurrentLanguageAsync("accessdenied.goDashboard", ct);
    }

    public async Task<string?> GetByLanguageAsync(CancellationToken ct)
    {
        return await _client.GetByLanguageAsync("accessdenied.goDashboard", "pt-BR", ct);
    }

    public async Task<int> CountResourcesAsync(CancellationToken ct)
    {
        var resources = await _client.ListResourcesAsync(ct);
        return resources.Length;
    }

    public async Task RefreshLocalizationCacheAsync(CancellationToken ct)
    {
        await _client.ClearCacheAsync(ct);
    }
}

Uso sem DI (Console/Desktop)

using SmartCoreHub.Localization.SDK.Clients;
using SmartCoreHub.Localization.SDK.Configuration;

var client = new LocalizationApiClient(new LocalizationSdkOptions
{
    BaseUrl = "https://api.smartcorehub.com",
    ApiKey = "SUA_API_KEY",
    Timeout = TimeSpan.FromSeconds(30),
    DefaultLocale = "pt-BR"
});

var value = await client.GetCurrentLanguageAsync("accessdenied.goDashboard");
Console.WriteLine(value);

API principal

  • GetCurrentLanguageAsync(resourceKey)
  • GetByLanguageAsync(resourceKey, languageKey)
  • ListResourcesAsync()
  • InvalidateCacheAsync(key)
  • ClearCacheAsync()

ListResourcesAsync retorna LocalizationResourceDto[].

Excecoes

  • LocalizationConfigurationException
  • LocalizationAuthenticationException
  • LocalizationRequestException
  • LocalizationSerializationException
  • LocalizationUnauthorizedException
  • LocalizationClientException
  • LocalizationServerException

Observacoes

  • Timeout padrao: 30 segundos.
  • O header de autenticacao enviado e X-Auth-Token (gerenciado pelo SDK).
  • Locale contextual e enviado internamente via Accept-Language quando DefaultLocale ou DefaultRequestSettings estao configurados.
  • O cache e opcional e controlado por Cache.Enabled.

https://www.nuget.org/packages/SmartCoreHub.Localization.SDK/

Licensing / Licenciamento

English

This project is provided for non-commercial use. Commercial use requires prior authorization from SmartCoreHub through a valid commercial license purchase or an active service contract. See the LICENSE file in this project for full terms.

Portugues (PT-BR)

Este projeto e fornecido para uso nao comercial. O uso comercial exige autorizacao previa da SmartCoreHub, por meio de aquisicao de licenca comercial valida ou contrato de servico ativo. Consulte o arquivo LICENSE deste projeto para os termos completos.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
20260727.438.0 44 7/27/2026
20260725.502.0 112 7/25/2026
20260722.2120.0 68 7/22/2026
20260719.2245.0 78 7/19/2026
20260718.424.0 170 7/18/2026
20260717.2036.0 110 7/17/2026
20260717.1613.0 90 7/17/2026
20260717.454.0 86 7/17/2026
20260714.2141.0 89 7/14/2026
20260608.447.0 155 6/8/2026
20260606.2303.0 122 6/6/2026
20260606.2034.0 104 6/6/2026
2026.6.6.19 99 6/6/2026
2026.6.6.3 100 6/6/2026
2026.6.5.2 101 6/5/2026
2026.6.4.3 107 6/4/2026
2026.6.2.22 101 6/2/2026
2026.6.2.2 179 6/2/2026
2026.5.30.20 104 6/2/2026
2026.5.30.4 114 5/30/2026
Loading failed