How to get multiple text fields in Tiddler?

323 views
Skip to first unread message

Sebas

unread,
Jan 30, 2016, 5:14:42 PM1/30/16
to tiddl...@googlegroups.com
Hi  everyone,

Have to say again, TiddlyWiki is great ... and more people need to know about it! ...

But my question: is there a way to get more than one "text" field in a tiddler?

I know I can just show the text of any field with {{!!myTextField}}, however this is not wikified correctly ... I think because there are no newline characters in it.
I want to have only one tiddler for one topic/semantic unit. At the moment I use something like this in one tiddler:
/define text_lang_en() ....
/define text_lang_fr() ....
<<displayLang text_lang_en>>
and so on. And then each tiddler has a macro that displays the correct language. But this is really not nice when editing it, I would rather like to be able to change the language with the ActionWidget so that the tiddlers text field refers to "text_en" or "text_fr" ... and the editor displays an empty new tiddler (for that language).
I know there are other means for translations, but this would not only be useful for translations.

I would greatly appreciate any ideas on this ...

Cheers,
Sebas

Sebas

unread,
Jan 30, 2016, 5:41:57 PM1/30/16
to TiddlyWiki
Hello again,

Just to give an example: If I create my own editor/menu for my tiddlers and use something like:

<$edit-text tiddler="Target" field="text"/>

In this example, I can put normal wikitext and macro definitions in the text field. Everything works just fine.

But if I want my own second text field like so:

<$edit-text tiddler="Target" field="MyTextField"/>

The widget will change to a one-line field and if I display {{!!MyTextField}}, this will not display like a normal tiddler, because many things will not work ... like macro definitions or more complex formating.

Is there a way to set any field to type "text/vnd.tiddlywiki"? I guess that is all I am looking for.

Best regards,
Sebas




Tobias Beer

unread,
Jan 30, 2016, 7:48:08 PM1/30/16
to TiddlyWiki
Hi Sebas,

I am not actually sure I quite understand the multi-language approach you were trying to take.
Fwiw, for more than one reason, I would not recommend overloading individual tiddlers
with various language versions of it in the form of fields, problem #1 being the title.

Admittedly, I have yet to see a properly defined multi-language operational mode emerge.

To avoid conflicts, I would have all tiddlers prefixed with the language, e.g. en-Welcome, fr-Bienvenue...
and then have that prefix removed from the title display, and display a "pretty-title" if defined in a field.

Ideally, that pretty title (or the title after removing the language prefix) is consistently displayed throughout the wiki,
not just in the title itself but also for links. So, this begs for a core LinkTemplate.

In any case, translations would not be different fields here, but independent tiddlers.
I probably would define a master language of which to make translated versions in other languages.
Each language version would point to the corresponding tiddler in the master language, e.g. in some "master" field.
In other words, all translated versions could be fetched by looking for all tiddlers that have their
master field set to a give title, e.g. to the same title as the one we're looking at...
and could be displayed as of this or that language depending on the prefix.

Best wishes,

Tobias.

Matabele

unread,
Jan 30, 2016, 10:06:17 PM1/30/16
to TiddlyWiki
Hi Sebas

This doesn't entirely address your problem, but might help a little.

Instead of {{!!MyTextField}} -- try this:

<$transclude field="MyTextField" mode="block"/>

However, I'm inclined to agree with Tobias -- I think it will be more flexible to create separate tiddlers for each language, then transclude the tiddlers (the 'text' field of each language tiddler.) In this way, the material can be edited as normal, and transclusion is simpler.)

A thought: if you peruse the material here -- I have been playing around with 'marking' tiddler titles with emoji. Perhaps you could use the relevant flag to mark the tiddler for each language. This might tidy up your naming scheme, as tiddlers 'marked' in this way can have the same plain text title.


regards

Sebas

unread,
Jan 31, 2016, 7:12:27 AM1/31/16
to tiddl...@googlegroups.com
Hi Tobias and Matabele,

Thanks a lot for taking the time to respond. I tried the <$transclude field="MyTextField" mode="block"/> approach, but unfortunately then I do not get macro definitions to work.
In regards to the titles, I already use this in my project and I do not have any problems with different languages. The titles displayed in the story view just use Conditional Variable Assignment and depending on which language is set up in a language field for a specific tiddler, that localized title is chosen. I just edited the $:/core/ui/ViewTemplate/title tiddler and here is a simplified example I made:

I know both of you are recommending to go the separate-tiddler-for-each-language approach, but this is what I am currently doing and I can confirm that this approach is a maintenance nightmare. My project uses a lot of parameterization, meaning that each tiddler makes heavy use of Jeremy's TiddlyWiki philosophy using the the smallest semantic units possible. Keeping the same context in one tiddler with different languages would make this easier.

I currently have a setup which works and groups tiddlers in this way:

/EN/Welcome_text
/FR/Welcome_text
/DE/Welcome_text
/ES/Welcome_text
/IT/Welcome_text
/PT/Welcome_text
...
However we are looking at hundreds of templates and we are using at least 6 languages at the moment and each text uses macros to modify certain portions, because on top of the languages, these semantic units also change depending on the recipient ... e.g. "issue_customer", "issue_agent", "issue_supplier", etc.

But each tiddler is a semantic unit of its own. Grouping one text in one tiddler ... often just a single sentence reused in many places ... would really make this thing much easier to manage. The end user does not care about the fields and is just presented with the text.

I'm sorry to disagree with you guys, but I would like to know if this is currently possible with TiddlyWiki. Can I change the text field at all or am I at a dead end here?

Thanks,
Sebas

Matabele

unread,
Jan 31, 2016, 7:23:42 AM1/31/16
to TiddlyWiki
Hi Sebas

Nice tip! Might be an idea to do the same for the SideBar listings.

regards

Matabele

unread,
Jan 31, 2016, 7:27:14 AM1/31/16
to TiddlyWiki
Hi Sebas

Perhaps, instead of transcluding the contents of other fields, you should exchange the contents with the 'text' field. That way, you can edit your text in the text field, then exchange the contents with another field, edit the text in another language in the text field ... and so on.

Viewing could be done the same way.

regards

Sebas

unread,
Jan 31, 2016, 7:46:35 AM1/31/16
to TiddlyWiki
Hey Matabele,

Yeah, thanks! That sounds like an idea I have not tried yet for text fields. And I am currently doing that already with my user interface. I have a dictionary tiddler that provides the names for each button in my TiddlyWiki (tiddler "/$:/./user_interface") and when the user changes the language, I just set this dictionary tiddler to the localized version like so:

<$button>
<$action-setfield $tiddler="/$:/./user_interface_EN" $field="title" $value="/$:/./user_interface" />ENGLISH
</$button>

I guess I could just swap the text fields in a similar way.

In regards to the sidebar and search fields, etc. - my approach is to leave most core tiddlers unchanged. I have "user versions" for the side bar and search fields so that they do not get to see the advanced search or the actual tiddler titles.

Thanks for the tip... I will try this.

Cheers,
Sebas

Matabele

unread,
Jan 31, 2016, 7:55:09 AM1/31/16
to TiddlyWiki
Hi

Might work quite well if you exchanged the contents out to one or more data dictionaries instead of a large number of fields in the current tiddler. Once the dictionaries and swopping mechanism have been implemented -- the process of editing should be transparent, and you'll no longer have to keep track of all the bits and pieces yourself. You can, therefore, employ as many dictionaries as needed to keep things arranged in logical order.

regards
Reply all
Reply to author
Forward
0 new messages