Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Extra-Dynamic Translation

So i'm mulling over the best way to go about this, and thought i'd throw open the world of ideas. Essentially, the sheet i'm creating is a template that replaces entire blocks depending on the 'class' of the character.  For example, every class gets two options for skills. I'm aware that I can have a select dropdown and use data-i18n-dynamic to pull the value of that attribute to get the class translation. But what i'd like to do is write the box to contain the "skill1" option and "skill2" checkboxes once in the sheet, and simply replace the text next to the checkboxes with a dynamic name from the translation file. IE: The Barbarian can choose "Ferocity" or "Adaptability", and the Rogue can choose "Thievery" or "Roguery" or whatever. ``` <select name='attr_class'> <option value='barbarian'>Barbarian</option> <option value='rogue'>Rogue</option> </select>... <label for='attr_skill1'><span data-i18n-dynamic name='attr_skill1'>The skill name should go here.</span></label><input type='checkbox' name='attr_skill1'> <label for='attr_skill2'><span data-i18n-dynamic name='attr_skill2'>The other skill name should go here.</span></label><input type='checkbox' name='attr_skill2'> ``` A sheet worker replacing hidden values to essentially dupe the class value into a bunch of other variables, just for the purposes of translation? Maybe... but is that the best way? Is there a better one i'm missing? I know i could replicate the page X times where X is the number of classes, but any programmer knows that if you're repeating things, you've missed a trick...
1624752637
GiGs
Pro
Sheet Author
API Scripter
If I understand your question fully, i think the translation issue is a red herring. The way to do this in roll20 is to have a different select for each class - each select has the same attribute name, and a different css class assigned to it. You then use CSS to hide them all, and show the one for the current class based on your class's CSS. No sheet worker needed.
1624785912
Andreas J.
Forum Champion
Sheet Author
Translator
Yeah, what GiGs said. Same would go for if you'd want to switch datalists for inputs , you'd simply have two inputs with the same name but different datalists, and switch which is visible to the user.
1625391774

Edited 1625391817
I was trying to not have to reproduce the same *entire sheet* for each of the 12 classes. That way if I had to change the design at some point, I only had to make 1 change instead of 12 and not missing any. Every piece of text barring a couple of headers is going to change with the class change.
1625399231
GiGs
Pro
Sheet Author
API Scripter
Unfortunately, that's the reality of creating sheets on roll20.
Yeah... Is the cost of a sheet worker changing the data-i18n values that much more 'expensive' (in browser work terms) than having 12 times the amount of HTML, being shuffled in and out by CSS state changing?
1625408232
GiGs
Pro
Sheet Author
API Scripter
I dont think roll20 allows you any control over changing the data-i18n values: it's completely controlled by the translation system.