You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation
Within the application I'm currently developing we encounter some strings that are dependent on a count parameter but do not strictly adhere the pluralization structure as Slang is using it. Take the following example into account:
"streak_banner": {
"l_one": "The algorithm favors active people",
"l_two": "Amazing to see your enthusiasm",
"l_three": "Your daily response improves matchmaking",
"l_four": "We're putting a spotlight on your profile!",
"l_five": "You're really here to take it offline!",
"l_six": "One more day makes a week",
"l_seven": "You're taking matters in your own hands",
"l_eight": "Every day, we get to know your taste better",
"l_nine": "Good to see you again!",
"l_ten": "People who respond daily get shown more to others",
"l_eleven": "Increased chances of finding a fun date",
"l_twelve": "Our algorithm is in love with your activity",
"l_thirteen": "Almost at the two-week mark",
"l_fourteen": "You're on a roll, keep it up!"
}
In this example above we're defining a set of strings that should be called based on the input parameter. Rather than defining custom conditions in the code I would prefer calling with the parameter, whereinafter slang decides on the correct key to use. This feature should support scenarios where the pluralization doesn't suffice.
Developer Experience
In my fork I've implemented this by allowing the node to include parameters, and a resolver attribute, as the following: "resolver_example(resolver=numericResolver, params=languageCount)": {
params is a comma splitted string representing the arguments that can be used to determine the key that should be picked. Instead of the returning a string an enum representing the possible keys could also be used.
I indeed looked into the enums feature as well, but the enum feature requires the group to have every enum and cannot exclude certain keys.
In my example I'm using all the keys, but I would like to have the possibility to leave out certain keys and dynamically based on the input arguments select the key / enum and have some flexibility here.
Motivation
Within the application I'm currently developing we encounter some strings that are dependent on a count parameter but do not strictly adhere the pluralization structure as Slang is using it. Take the following example into account:
In this example above we're defining a set of strings that should be called based on the input parameter. Rather than defining custom conditions in the code I would prefer calling with the parameter, whereinafter slang decides on the correct key to use. This feature should support scenarios where the pluralization doesn't suffice.
Developer Experience
In my fork I've implemented this by allowing the node to include parameters, and a resolver attribute, as the following:
"resolver_example(resolver=numericResolver, params=languageCount)": {
params is a comma splitted string representing the arguments that can be used to determine the key that should be picked. Instead of the returning a string an enum representing the possible keys could also be used.
I'm curious about opinions about this potential feature, if in favor of implementing this I can submit a PR for this with my current implementation.
The text was updated successfully, but these errors were encountered: