Skip to content

Conversation

@tom-englert
Copy link
Collaborator

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for LCID (Locale Code Identifier) representation for languages in Power Apps Component Framework (PCF) projects, where culture information is represented as numeric locale identifiers (e.g., "1033" for en-US) instead of BCP 47 language tags (e.g., "en-US"). The implementation detects the representation type automatically and handles file naming accordingly.

Key Changes:

  • Introduced CultureRepresentation enum and CultureDefinition class to track whether a resource file uses Name-based or LCID-based culture representation
  • Enhanced CultureHelper.CreateCultureInfo to parse both language tags and numeric LCID values
  • Updated GetLanguageFileName to generate appropriate filenames based on the culture representation type

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ResXManager.Infrastructure/CultureKey.cs Added CultureRepresentation enum and CultureDefinition class to distinguish between Name and LCID representations
src/ResXManager.Infrastructure/CultureHelper.cs Added CreateCultureInfo method that parses both language tags and numeric LCIDs
src/ResXManager.Infrastructure/ExtensionMethods.cs Refactored ToCulture and ToCultureKey to use new CreateCultureInfo; added NullIfEmpty helper
src/ResXManager.Model/ProjectFileExtensions.cs Renamed GetCultureKey to GetCultureDefinition; updated GetLanguageFileName to accept ResourceLanguage and handle LCID-based naming
src/ResXManager.Model/ResourceLanguage.cs Updated constructor to accept CultureDefinition; added CultureRepresentation property
src/ResXManager.Model/ResourceEntity.cs Updated to use GetCultureDefinition and improved language ordering logic
src/ResXManager.Model/ResourceManagerExtensions.cs Changed verbatim string to regular string literal
src/ResXManager/MainViewModel.cs Updated method call from ProjectFile.GetLanguageFileName to ResourceLanguage.GetLanguageFileName
src/ResXManager.VSIX/MyToolWindow.cs Updated method call; reordered using statements; changed .Any() to .Count == 0
src/ResXManager.Scripting/Host.cs Updated method call from ProjectFile.GetLanguageFileName to ResourceLanguage.GetLanguageFileName
src/ResXManager.View/Visuals/TranslationsViewModel.cs Updated to use collection expression syntax for Split separator
src/ResXManager.View/Tools/ColumnManager.cs Trailing whitespace cleanup
src/ResXManager.Tests/UnitTest1.cs Added test cases for LCID validation (1031, 1033, 0, -1, 256)
src/ResXManager.Tests/Resources/Lcid/*.resx Added test resource files with LCID-based naming (Lcid.7.resx, Lcid.12.resx, Lcid.1033.resx)
src/ResXManager.Tests/ResXManager.Tests.csproj Configured Lcid.1033.resx to not generate code
src/ResXManager.config.xml Added "Lcid" to file exclusion filter
src/ResXManager.sln.DotSettings Added "Resw" to custom dictionary
Comments suppressed due to low confidence (1)

src/ResXManager.Infrastructure/ExtensionMethods.cs:62

  • The ToCultureKey method now calls ToCulture which throws InvalidOperationException for invalid culture names, but the catch block only catches ArgumentException. This means ToCultureKey will throw instead of returning null for invalid culture names, breaking its contract and potentially causing unexpected exceptions at runtime.
    public static CultureKey? ToCultureKey(this string? cultureKeyName)
    {
        try
        {
            return ToCulture(cultureKeyName);
        }
        catch (ArgumentException)
        {
        }

        return null;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tom-englert tom-englert merged commit 6bd024f into master Dec 13, 2025
8 checks passed
@tom-englert tom-englert mentioned this pull request Dec 13, 2025
@tom-englert tom-englert deleted the LCID_support branch December 14, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants