Is this an example of abusing user-defined functions? #1110
Replies: 5 comments 2 replies
|
This looks like an ICU4C bug that should be reported in its issue tracker: https://unicode-org.atlassian.net/jira/ Edit: Maybe I misunderstood? Is the |
|
I don't think this is a bug in the ICU4C implementation. My only problem is registering a custom function without a namespace.
With If this is an abuse or not, or if it is bad for l10n or not, depends on the intent of the function. The literal placeholder ( Although I don't think it is technically incorrect, I cannot tell if such a function is a bad idea or not. Not until I can hear what the use case is. |
|
Your example might be written differently, sorta like this: If your intention is to introduce a function that can format string fragments with placeholders in them, then that's, to @mihnita's point, something your function is permitted to do. (Please use a namespace) It is probably a Bad Idea to have a function that does that for arbitrary text patterns, because MF2 is already designed to do your formatting. MF2's syntax was designed to avoid string concatenation masquerading as a function (it is what selectors are for), because it is difficult to do grammatical matching and agreement in such cases. Rendering your example into a sentence (instead of using subject:predicate form) might make clearer the problem: ... which produces ungrammatical results for the This isn't to say that you could not have a function that uses a pattern string, though. Skeletons for dates work sort of like that, for example. |
|
Thanks for replies. I would to split message to fit the mf2 model. |
I don't think I understand your comment. Can you explain what |
Uh oh!
There was an error while loading. Please reload this page.
When I tried to register custom function by ICU4C, I found it is possible to implement function
formatlike below:It can produce
example: placeholder: some textAm I abusing this feature?
All reactions