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

V12: Add ISO codes to make the migration from language IDs easier #14567

Conversation

elit0451
Copy link
Member

Details

  • In relation to the concerns from Obsolete language ID related properties and methods for V13 #13753, this PR introduces IDictionaryTranslation.LanguageIsoCode and DictionaryTranslation.LanguageIsoCode and ILanguage.FallbackIsoCode and Language.FallbackIsoCode properties, to make the migration from language IDs easier;
    • The obsoletion messages related to language IDs are changed to V14 (instead of 13).

Test

  • Use the following test controller and the debugger to inspect each object in dictionaryItem.Translations and allLanguages as it says in the comments in the code:
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.Controllers;

namespace Umbraco.Cms.Web.UI;

public class TestController : UmbracoApiController
{
    private readonly ILocalizationService _localizationService;

    public TestController(ILocalizationService localizationService)
    {
        _localizationService = localizationService;
    }

    // /umbraco/api/test/test
    public IActionResult Test()
    {
        // check that each translation has a valid LanguageIsoCode now
        var dictionaryItem = _localizationService.GetDictionaryItemByKey("test");

        // check that each language has a valid FallbackIsoCode (compare with FallbackLanguageId)
        //      when FallbackLanguageId is null, FallbackIsoCode is also null
        //      when FallbackLanguageId is set, FallbackIsoCode value should correspond to the given FallbackLanguageId
        var allLanguages = _localizationService.GetAllLanguages();

        return Ok("Working");
    }
}

Copy link
Contributor

@nikolajlauridsen nikolajlauridsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a couple of breaking changes we should get resolved first 😄

src/Umbraco.Core/Models/IDictionaryTranslation.cs Outdated Show resolved Hide resolved
src/Umbraco.Core/Models/ILanguage.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@nikolajlauridsen nikolajlauridsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and tests good now 💪😄

Will merge when lights go green 🎉

@nikolajlauridsen nikolajlauridsen merged commit ba423a0 into v12/dev Jul 18, 2023
15 checks passed
@nikolajlauridsen nikolajlauridsen deleted the v12/feature/add-iso-codes-to-make-migration-from-lang-ids-easier branch July 18, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants