Multilanguage TiddlyWiki - Any existing resources?

I understand that this is a first prototype and that more details could be included on this $:/core/ui/EditTemplate/body/editor Tiddler. But a complete version of that would be enough for me. Considering that the editor stays that way by now, the next step would be changing the languages globally. What approach could I use to switch the content of the visible tiddlers to the second language? I imagine something like:

A button that makes the reference that’s currently reading the text body changes to reading the text-fr field. That functionality wouldn’t be implemented inside $:/core/ui/EditTemplate/body/editor, would it? Is there a different core Tiddler that I need to edit to build this functionality?

Assuming you want both content and TiddlyWiki features to both show in one language across the board, you could easily just use TiddlyWiki’s language button.

If you haven’t set up your TiddlyWiki for English and your other language, you’ll want to visit your control panel, go to plugins tab, get more plugins and get the language plugin you need.

When you click on that language button and change language, note that the $:/language tiddler is something you can use to affect the display of your content throughout your TiddlyWiki.

That’s nice and easy. No work needed for you to have a button to choose language and have that choice stored somewhere.

Although the initial concept/prototype can be followed up with fairly easy tweaks to the “tiddler view template something something” (I can’t remember the name of it), the concept I did does not handle: what to show when a tiddler is transcluded.

So the original concept, I think, needs to be rejigged so that French text is, yes, in text-fr field, but English text should be in text-en field.

And the normal “text” field needs to have the smarts to say "hey, if English is selected, show text-en; if French is selected, show text-fr.

Handling of multi-lingual tiddler titles needs to be considered too, whether it be direct/indirect/derived/other?

I want to say I have no time for this project, but …

If my subconscious mind is like a scary number of hamsters spinning in hamster wheels, there is a lot of activity going on back there. I may just have no choice but to hash together another prototype within the next couple of days IF I can find the time. I’m thinking it is easy, but there’s a gremlin waiting around every corner just itching to lodge a stick in my “why couldn’t we” wheels.

Something like that.

Progress Report

So I’ve got the prototype setup to automagically created edit panels for every language plugin added to TiddlyWiki.

When editing a tiddler, a pane is created for each language, with just basic collapsing of a language using an HTML details element.

And each language panel saves to a related text field in the tiddler.

For the moment, access to the tiddler text field involves clicking a preview button in any of the language-specific panels. That’s just an easy way to get to the standard text field.

Two things to note in that last screenshot: the tiddler will display in the tiddler body the content related to the chosen language in TiddlyWiki, and that currently involves making sure the tiddler’s standard text field has, and has nothing but, {{ || tText }}

The “tText” tiddler:

I am pausing there while I put some thought on tiddler titles (i.e. how to handle that in a multilingual tiddlywiki.

Fun !

  • I think, the main language should be kept in the default text field of the tiddler.
  • The text view should not be coupled to the installed languages in the wiki.
    • languages add quite an extra weight to the file size
  • Switching the viewed language should be independent to the UI language setting.
    • eg: my personal Windows setting uses English language. Some programs use German language, some use English language. … Text to speech depends on the text language … Speech to text is set to English by default. …
  • So even if the UI is set to 1 language, imo it doesn’t mean that the tiddler text should also be shown in that language all the time.

According to the tiddler title, I do have an idea, that is opinionated to my personal needs. So it may or may not work for someone else.

I’ll post a link to a working prototype soon.

1 Like

Excellent. Variety is the spice of life, so good to have various prototypes going on.

I’m glad that’s the approach you’re taking, for the sake of variety. Because I rather not do that. I will continue along with my approach, because it is no fuss no muss work with transclusion of a tiddler without getting into any special setup to work with transclusion of tiddlers across the board (TiddlyWiki functionality and functionality of any plug-in’s.). I’m thinking my approach here should work across the board, but proof will be in the pudding.

Good to have alternative approach. To me, comprehensive language testing (content and interface) is a continuous process. So the cost of weight is worth it until it is too much. I see internal version as heavy, and “published” version as the one that is trimmed down. Until it no longer works … So I carry on for now.

By default, I am tying TiddlyWiki interface and content to same language as chosen via TiddlyWiki interface, to keep things simple. I might consider adding the complexity you’re talking about later, maybe. I’m undecided about the cost/benefit. I may stand tall on your shoulders when the time/need smacks me.

Multilingual TiddlyWiki. I can’t imagine one solution that works for everybody. The one solution that works for everybody might be so heavy that it works for nobody.

Good stuff. Cheers !

1 Like

:slight_smile: … right. … I did some coding today and I’m running against walls from time to time, with the existing EditTemplate structure. … I have to tweak the core templates more as I initially wanted.

It’s interesting, since my usecase actually is a completely different one. … I wanted to have an “aside area” in a side by side view. … So not a different language, but some comments … The principle is the same. …

I also wanted to have a simple possibility to edit mulit-line fields in the default editor. … That’s working nice already.

Tell me about it. My mind is racing with possibilities. Even simple things like side-by-side editor, left side for “text” field, right-side for choice of editing any other field in the tiddler with a textarea instead of the default input fields.

And I’m thinking in a node.js setup, one TiddlyWiki for authoring all of the possibilities (of whatever), which can be used to publish versions.

Sticking to multilingual scope, could have one TiddlyWiki for editors and all languages, and when ready to publish, have a process to export for each individual language.

Something like that.

Just a progress report, printout of noteworthy stuff in attached PDF. Crap, PDF not allowed. (interlude …)

  • A few tweaks aside related to modified version of $:/core/ui/EditTemplate/body/editor
  • I’ve come to the tentative conclusion that I am going to treat alternative tiddler titles as language-related aliases, but only for-display aliases, not for-typing-links-using-aliases-as-alternatives-to-tiddler-titles.
  • I’ve also decided that it is a bad idea to use TiddlyWiki’s default title and default text field as fields for the default language. (Say a TiddlyWiki is delivered to somebody with English, Spanish, and French, and the person decides to lighten the load by getting rid of English text and just keeping Spanish and French. Hard to do when English was entered in the standard TiddlyWiki title and text fields. Seems to me. Much easier to say: “hey, get rid of all title-en-GB and all text-en-GB fields.”)

Cheers !

Attachments:

Okay, images:



Code for modified $:/core/ui/EditTemplate/body/editor tiddler (nothing fancy, just good-enough for prototyping’s sake):

<$list filter="[[$:/state/showeditpreview]get[text]match[yes]then<currentTiddler>] [<currentTiddler>fields[]regexp[text-]count[]match[0]then<currentTiddler>]">
<$edit

  field="text"
  class="tc-edit-texteditor tc-edit-texteditor-body"
  placeholder={{$:/language/EditTemplate/Body/Placeholder}}
  tabindex={{$:/config/EditTabIndex}}
  focus={{{ [{$:/config/AutoFocus}match[text]then[true]] ~[[false]] }}}
  cancelPopups="yes"
  fileDrop={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}}

><$set

  name="targetTiddler"
  value=<<currentTiddler>>

><$list

  filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]"

><$reveal

  type="nomatch"
  state=<<config-visibility-title>>
  text="hide"
  class="tc-text-editor-toolbar-item-wrapper"

><$transclude

  tiddler="$:/core/ui/EditTemplate/body/toolbar/button"
  mode="inline"

/></$reveal></$list><$list

  filter="[all[shadows+tiddlers]tag[$:/tags/EditorTools]!has[draft.of]]"

><$list
	filter={{!!condition}}
	variable="list-condition"
><$transclude/>
</$list></$list></$set></$edit>

</$list>

<$list filter="[[$:/state/showeditpreview]get[text]match[no]then<currentTiddler>fields[]regexp[text-]first[]then<currentTiddler>]">
<div style="display:table;; width:100%;">
 <$list variable="thisLanguage" filter=" [[$:/languages/en-GB]] [plugin-type[language]sort[description]] ">
<div style="display:table-cell; border:2px solid purple;">
<details open><summary>
<$text text={{{ [<thisLanguage>get[description]] }}}/>
</summary>
<$edit-text field={{{ [<thisLanguage>split[/]last[]lowercase[]addprefix[alias-]] }}} class="wide100"/>
<$edit

  field={{{ [<thisLanguage>split[/]last[]lowercase[]addprefix[text-]] }}}
  tag="textarea"
  class="tc-edit-texteditor tc-edit-texteditor-body"
  placeholder={{$:/language/EditTemplate/Body/Placeholder}}
  tabindex={{$:/config/EditTabIndex}}
  focus={{{ [{$:/config/AutoFocus}match[text]then[true]] ~[[false]] }}}
  cancelPopups="yes"
  fileDrop={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}}

><$set

  name="targetTiddler"
  value=<<currentTiddler>>

><$list

  filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]"

><$reveal

  type="nomatch"
  state=<<config-visibility-title>>
  text="hide"
  class="tc-text-editor-toolbar-item-wrapper"

><$transclude

  tiddler="$:/core/ui/EditTemplate/body/toolbar/button"
  mode="inline"

/></$reveal></$list><$list

  filter="[all[shadows+tiddlers]tag[$:/tags/EditorTools]!has[draft.of]]"

><$list
	filter={{!!condition}}
	variable="list-condition"
><$transclude/>
</$list></$list></$set></$edit>

</details>
</div>
</$list>
</div>
</$list>
2 Likes

For Future reference the title of this Topic is not friendly, the following is generic

Is there any resource in TiddlyWiki that helps me to create a

Before we actualy see the subject

multilanguage TiddlyWiki?

So almost every where I see it listed I have no idea what it is about.

Consider reworking to put the subject first, and titles can be “simplified”

Multi-language TiddlyWiki?, Help and resources?

I did change the title of the thread.

1 Like

As part of the process, I assume folk who edit somebody else’s post or discussion title let the original poster know that the edit was done and why it was done, right?

2 Likes

@Rafael I did just publish 2 new plugins. The Field Visibility and the Field Editor plugin. Both of them can be used to create a setup very similar to what you described.

The video, how the plugins can be used is here: Field Editor & Field Visibility Plugin - YouTube

have fun!

4 Likes

Some nice Ideas here Mario. Some of which can go a lot further and address other issues elegantly. Great use of video too.

Love your work

@Rafael … Did you test anything posted here? … Are you still listening?

@pmario

I posted on your Youtube video as well, but I wanted to thank you for this plugin. It’s extremely useful.
I had one quick question about referencing Tiddlers in Tiddlers.
I’m using the “@details” plugin and trying to do this kind of reference. But it doesn’t respect my currently selected field. Is there a way to force the field when referencing a tiddler? Again, I know this is early so if it’s impossible, I totally understand. Thanks again for making such a great plugin!

<$details summary=“Details Header”>

{{SeparateTiddlerPage}}

</$details>

@KTallguy I think it’s possible to create a template, that also respects the active-field setting. The transclusion with the $details widget would look like this.

<$details summary=“Details Header”>

{{SeparateTiddlerPage||fieldTemplate}}  or {{SeparateTiddlerPage||§}} //if you use the shorter name for the template

</$details>

Create a tiddler named: fieldTemplate with the following text. … You can use a shorter name for the template, to have less to write eg: § or something similar.

<$set name=Field value={{{ [{$:/config/wikilabs/viewtemplate/body/field-config}get[text]trim[]!match[text]] }}}>
<$transclude field={{{ [all[current]has<Field>then<Field>else[]] }}}>

<$transclude>

</$transclude>
</$set>

Thank you for your reply.
And amazing! I tried it and it worked.
On the “fieldTemplate” tiddler, this message displays, but the functionality seems fine.
"Recursive transclusion error in transclude widget"

Thanks again for the solution! :slight_smile:

Right gents, so how does the casual user install this feature? I am loving it!

Hi J,
There is a separated intro-thread at: [Intro] Field Editor Plugin where I also linked a video.

The field visibility plugin intro is at: [Intro] Field Visibility Plugin … BUT there is room for improvement.

I just know Multiline Field Editor Plugin can be used to make doc wiki have multiple language!

This will be very useful.