8000 Curly braces in string cause error · Issue #51 · LazZiya/XLocalizer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Curly braces in string cause error #51

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

Open
julianadormon opened this issue May 15, 2025 · 1 comment
Open

Curly braces in string cause error #51

julianadormon opened this issue May 15, 2025 · 1 comment

Comments

@julianadormon
Copy link

Hi! I hope you're well. I am getting the following error when the string includes curly braces.

Here is the code (running on Blazor server) version 1.0.3 with Google translate 1.0.1:
@if (!string.IsNullOrEmpty(Model.Product?.Description))
{

@localizer[Model.Product.Description]

}

Here is the actual string value (there is \r\n before the curly brace, but other values using line breaks work ok):
8x10 Memory Mate
{4} Wallets (same pose as memory mate individual image)

Here is the error:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ReadOnlySpan1 args) at System.String.FormatHelper(IFormatProvider provider, String format, ReadOnlySpan1 args)
at XLocalizer.XStringLocalizer`1.GetLocalizedString(String name, Object[] arguments)
at ProofpixClient.Shared.PricelistProductCard.b__0_0(RenderTreeBuilder __builder2) in /Users/macminim1/Projects/Proofpix-V2/ProofpixClient/Shared/PricelistProductCard.razor:line 81
at Radzen.Blazor.RadzenCard.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)

Thanks for looking into this.

Image

@LazZiya
Copy link
Owner
LazZiya commented May 15, 2025

Hi @julianadormon ,

Looking at the provided string in the screenshot, it has this placeholder "{4}", it should be "{0}" cuz there is only one value. Also make sure you provide the relevant argument as necessary.

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

No branches or pull requests

2 participants
0