Closed makorne closed 3 years ago
Thank you for your issue! It looks like there's an error in your fluent source code. Specifically a-zA-Z
is invalid.
I'm also running into this issue. The provided answer is a little unclear. Could you please specify @XAMPPRocky? What part of the code precisely is wrong?
@MichaelBradetLegris Your fluent (.ftl
) code has invalid syntax, I couldn't tell you more without seeing it.
Closed or not, I have just encountered this problem and solved it by re-naming all of the equivalent variables in each different ftl file. Which makes me wonder why there are different locale directories in the first place.
@TimMaher Each file in a locale directory is bundled into a single FluentBundle
for the locale. That's not how variables work so you were running into a different issue, which happened to be fixed when you renamed your variables. I'm not sure you're even talking about variables, as you can't define variables, you can only use variables in a placeable of a term, and like what I said above, terms are not shared between locales. If you want to have shared terms use the core_locales
in the static loader, or the shared_resources
option.
If you're getting the error above, your fluent syntax was incorrect.
Thanks XAMPP,
We are talking about slightly different things I guess, largely because my language was imprecise. The “variables” I was referring to are items in each of the .ftl files. So, if I have an item with a label hello and that item is in each of locales/core.ftl and locales/en/main.ftl it will throw the error when I try to get the value in my main function. I have to give them different names in each file. In this instance I have called the first one hello and the second one en-hello.
Perhaps I have not fully understood the static loader implementation?
Best Regs
TIm Tim Maher-De Troyer @.***
BTW… Happy New Year! Bit late but...
On 8 Jan 2023, at 17:36, XAMPPRocky @.***> wrote:
@TimMaher https://github.com/TimMaher Each file in a locale directory is bundled into a single FluentBundle for the locale. That's not how variables work so you were running into a different issue, which happened to be fixed when you renamed your variables. I'm not sure you're even talking about variables, as you can't define variables, you can only use variables in a placeable of a term, and like what I said above, terms are not shared between locales. If you want to have shared terms use the core_locales https://docs.rs/fluent-templates/latest/fluent_templates/macro.static_loader.html in the static loader, or the shared_resources https://docs.rs/fluent-templates/latest/fluent_templates/struct.ArcLoaderBuilder.html#method.shared_resources option.
If you're getting the error above, your fluent syntax was incorrect.
— Reply to this email directly, view it on GitHub https://github.com/XAMPPRocky/fluent-templates/issues/29#issuecomment-1374888155, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVYV5P4T2XLVIK5HH574NDWRL3JNANCNFSM45YFA47Q. You are receiving this because you were mentioned.
So, if I have an item with a label hello and that item is in each of locales/core.ftl and locales/en/main.ftl it will throw the error when I try to get the value in my main function.
Yes, you shouldn't define them in both, that's equivalent to defining it twice in a single file, which is the error you're getting. You shouldn't be trying to overriding it with the same message ID. Core locales are for things that are always the same across all locales, and you should have separate messages or terms defined when its locale specific.
Without knowing the specifics you shouldn't have hello
and en-hello
, as that's not actually descriptive or cross-locale compatible. You should have something like hello
and hello-message
.
Ahh... that explains it. It’s in the core. I should have spotted that as I had to specify a default, which would not, therefore, expect a core.
Thanks for that.
Regs
Tim
Sent from my iPad
On 8 Jan 2023, at 18:16, XAMPPRocky @.***> wrote:
So, if I have an item with a label hello and that item is in each of locales/core.ftl and locales/en/main.ftl it will throw the error when I try to get the value in my main function.
Yes, you shouldn't define them in both, that's equivalent to defining it twice in a single file, which is the error you're getting. You shouldn't be trying to overriding it with the same message ID. Core locales are for things that are always the same across all locales, and you should have separate messages or terms defined when its locale specific.
Without knowing the specifics you shouldn't have hello and en-hello, as that's not actually descriptive or cross-locale compatible. You should have something like hello and hello-message.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
Hi something went wrong. rustc 1.52.1