Closed dgaedcke closed 3 years ago
Hi @dgaedcke,
Comments like "// skipped getter for the ..." are generated in the case when the key values can't be parsed. There are many reasons why parsing can fail (e.g. invalid placeholder name, invalid message syntax, currently unsupported message syntax, etc.).
Maybe I could help you with more details if you can share a translation of the mentioned BlockUser
key.
More details regarding messages you can find here under Getting started - Add keys to main ARB file.
Regarding regeneration, it will be triggered every time you update and save your .arb
files.
Also, all generating logs can be found under OUTPUT
panel for the Flutter Intl
.
Hope it helps!
Ah, I'm guessing it's the "%@" placeholder from IOS that's causing this problem. Here is my row: "BlockUser" = "Block TS User %@";
What placeholder should I use instead to get past this parsing error??
And since I'm regenerating this .arb file off of the IOS source, I'll be replacing it in the directory & never editing it intentionally in VS Code. Must I perform a mock-edit in VS Code to force the regeneration of i10n.dart or will you auto-detect the new modification date. Thanks so much for your help and insights!!
... more specifically about that placeholder substitution, instead of a getter, I need a method to perform string interpolation.
Ah yes ... I see it now ...
I should replace the "%@" with "{userId}" to cause you to generate a method instead of a getter....
I missed this on first reading ... I was sleepy but I think I now have enough to move forward. Thanks for your help!!
I've converted my intl_en.arb file to contain contents like this: "BlockUser": "Block TS User {userId}"
And yet I'm still seeing this error: // skipped getter for the 'BlockUser' key
and I'm not seeing any corresponding methods to get strings with interpolated values
Any thoughts about what else I'm doing wrong??
Ah, I see the problem ... I didn't update the placeholders dict
Hi @dgaedcke,
Sorry for the late response.
By default, VS Code will trigger the generation of localization files every time you open the project within it.
After that, the generation will be triggered only when .arb
files are saved.
Modification date tracking isn't supported at the moment but sounds like a good idea for future improvements.
Regarding translations with placeholders (string interpolation), you are right, you just need to wrap placeholder name within curly braces. Note, the current implementation doesn't require the existence of placeholders dict., but it is recommended to have it.
You know your code, but I'm 100% certain that those methods were not being generated until I added the placeholder keys. But that simple change caused them to be built on the next save.
The fact that the argument types are "object" rather than "String" might give some hint that you are not relying on the "text" value. Or perhaps you are just anticipating the toString overload & leaving Object for maximum flexibility?
Thanks for your help!
I'm getting lots of these: "// skipped getter for the 'BlockUser' key"
Can you tell me why or how to avoid it??
Also, how do I regenerate the static values (class S) when my base English .arb (source) files change??