SmartCoreHub.Localization.SDK 20260727.438.0

dotnet add package SmartCoreHub.Localization.SDK --version 20260727.438.0
                    
NuGet\Install-Package SmartCoreHub.Localization.SDK -Version 20260727.438.0
                    
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="20260727.438.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartCoreHub.Localization.SDK" Version="20260727.438.0" />
                    
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 20260727.438.0
                    
#r "nuget: SmartCoreHub.Localization.SDK, 20260727.438.0"
                    
#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@20260727.438.0
                    
#: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=20260727.438.0
                    
Install as a Cake Addin
#tool nuget:?package=SmartCoreHub.Localization.SDK&version=20260727.438.0
                    
Install as a Cake Tool

SmartCoreHub.Localization.SDK

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

Pacote auto-isolado: nao depende de SmartCoreHub.Core.SDK. Cliente NuGet recebe apenas Localization.SDK (+ Microsoft.Extensions). Detalhes: Isolamento-Core.md.

Extensao VS Code / Cursor: SmartCoreHub Localization SDK VC — Configure Connection, playground, snippets schl-* e contexto para agentes (IdeExtensions).

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 ILightweightCacheProvider (neste pacote)
  • 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

  • Um dos targets suportados pelo pacote NuGet:
    • netstandard2.0 / netstandard2.1
    • net6.0
    • net8.0
    • net10.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:

using SmartCoreHub.Localization.SDK.Caching;
using SmartCoreHub.Localization.SDK.Extensions;

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

Breaking changes

Isolamento do Core.SDK (atual)

Quem passou a tipar DI/opcoes com tipos SmartCoreHub.Core.SDK.* apos o Lote 7 deve migrar de volta aos tipos deste pacote:

Antes (Core.SDK) Agora (Localization.SDK)
Others.Service.Http.Abstractions.IApiErrorMapper Abstractions.IApiErrorMapper
Others.Service.Http.Abstractions.IAuthHeaderProvider Abstractions.IAuthHeaderProvider
Others.Infrastructure.Caching.ILightweightCacheProvider Caching.ILightweightCacheProvider
…Providers.LightweightMemoryCacheProvider Caching.LightweightMemoryCacheProvider

Nao ha dependencia NuGet de SmartCoreHub.Core.SDK.

Historico Lote 7 (supersedido pelo isolamento)

O Lote 7 havia removido shims locais e apontado para Core; o isolamento reintroduz os contratos owned no Localization (sem cascas Obsolete).

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

Documentacao interativa da API (OpenAPI)

O SDK consome a SmartCoreHub.Localization.API via HTTP. Em desenvolvimento local, a API expoe o mesmo pipeline de documentacao que as demais APIs SmartCoreHub (ver Documentation/Features/FEITOS/API-DOCUMENTATION-UI.md).

Substitua {base} pela URL HTTPS da API em execucao:

Ambiente local {base}
SmartCoreHub.Localization.API https://localhost:61115
SmartCoreHub.API (referencia) https://localhost:53814

UIs e documento OpenAPI

URL Descricao
{base}/ Redireciona para Swagger UI
{base}/swagger/index.html Swagger UI
{base}/openapi/v1.json JSON OpenAPI nativo (runtime)
{base}/openapi Redireciona para Scalar UI
{base}/scalar/v1 Scalar UI
{base}/redoc ReDoc
{base}/rapidoc RapiDoc
{base}/health Liveness
{base}/ready Readiness
{base}/health/ready Alias de readiness (somente Localization API)

Exemplo (Localization API em dev):

  • https://localhost:61115/swagger/index.html
  • https://localhost:61115/openapi/v1.json
  • https://localhost:61115/scalar/v1
  • https://localhost:61115/redoc
  • https://localhost:61115/rapidoc

Guia completo: API-DOCUMENTATION-UI.md.

Endpoints REST (sem SDK)

Autenticacao: header X-Auth-Token com sua API key.

Metodo Rota Parametros
GET /api/localization/client/currentlanguage resourceKey; locale opcional via Accept-Language
GET /api/localization/client/bylanguage resourceKey, languageKey
GET /api/localization/client/list

Documentacao publica na landing: rota /docs-api.

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 net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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