Multilanguage TiddlyWiki - Any existing resources?

I was searching on https://tiddlywiki.com if I could find a way of creating a multilanguage TiddlyWiki and I found this alternative german page https://tiddlywiki.com/languages/de-DE/index.html… Well, this is still a completely different TiddlyWiki, I’d like to find a way of having two editors for the same Tiddler, just so if I click to change the language it lets me write the text from zero again in a second language. I imagine something like the following:

That’s just one idea that I thought. I’m not stuck on having something exactly like this… Is there any reusable structure that I can use for dealing with this kind of problem? Can I have different texts in the same Tiddler? So each text represents a different language?

3 Likes

At the moment translations are “plugins” that only let you change the UI language. See the ControlPanel : Plugins : Languages / Sprachen tab. …

The English language is always installed, because it is used as the “fallback language”, is some texts are missing in translations. …

We don’t have a mechanism at the moment, that let’s you have 2 active languages at the same time. …

I do have a draft-pull-request at github that would allow us to create plugins that contain “the same tiddler titles” with different content.

But that’s probably not what you want. … It seems you want to switch the content on a per tiddler basis in edit mode and then “globally” switch language in view-mode … right?


There is some work going on at the moment, that will allow us to be much more flexible with our View- and EditTemplates … BUT that’s not finished yet.


If you could be a bit more specific about your usecase, I think it would be easier to be more specific in my suggestions.

As I wrote. Switching languages for the UI works with the same tiddler titles. By switching the UI language we “replace” the existing English shadow tiddlers with the same tiddler titles but different content.

In your image you have a tiddler named: Editions … In the second language this tiddler title will need to be different. right? …

Do you need to have 2 tiddlers with different languages open at the same time in “view / reader” mode, or should only 1 language be active at a time for your users?

I think it would be possible to create a tool that appears in the edit bar that lets you switch between languages (or versions) of a tiddler. The versions would be stored in fields in the tiddler like lang-en, lang-de, etc. It could be used also for versions of a tiddler. Like if you were working on different versions of a chapter, but wanted to switch back and forth. Or for that matter, even code. Though there already is a plugin to save versions of tiddlers.

@pmario

If you could be a bit more specific about your usecase, I think it would be easier to be more specific in my suggestions.

My use case is very similar to what you described… I imagine something where I can edit individual tiddlers in edit mode, and having a global switch where I can change everything at once would be fine too. In an ideal world, I think something like the “Show preview pane” button would be great, but I don’t how difficult it’d be to implement something like this… :thinking:

In my view, having two Tiddlers one for each language would also mean having to organize their tags individually, right? So if I change a tag in a Tiddler on a language that would also mean that I’d have to manually change the other Tiddler in the other language? In the long term, I don’t trust myself enough to keep it organized and synchronized if I have to do it manually… So I’m looking for a solution where it can be automated in a way that I can quickly identify the text and the title to translate (you also asked about the title, but I wouldn’t mind having the Tiddler title in a single language)…

About the UI language… For me, it’s completely OK it be always in English… The main issue for me is the Tiddler text by now…

Although I know not of any pre-canned solution for your needs, I’ve got just enough experience with maintaining multi-language content in a wiki, and just enough experience with TiddlyWiki to know what kind of architecture I’d be prototyping.

So I’ll just throw my 2 cents in, which aren’t worth much after taxes…

When maintaining multi-language content in any kind of wiki, to keep content in sync, proximity is gold.

So if you are making a change to the English text for some Tiddler, it is nice to simultaneously make the same change to, say, the French text right beside the English.

Even if somebody enters English text for the French translation to be entered later, the English text might need simultaneous tweaks as the French version is updated.

To me, the best way to go would be for a tiddler to contain all translations right there, and for the TiddlyWiki Tiddler editor to be modified so that the left pane is for entering text in one language, and the other pane is for entering the same text translated in the other language.

Assuming the work is being done at a computer with a wide enough display.

All bets are off with smartphone/tablet (whatever small display device) in regards to maintaining the content. Viewing isn’t any problem.

There isn’t any wrong way to go about it, but I’d prefer create a little bit of architecture to support the design approach I have in my head.

UPDATE: I attached a JSON file with the related shadow tiddler I modified. Drag into tiddlywiki.com, and compare the tiddler to the original by putting side-by-each updated tiddlywiki next to unmodified tiddlywiki. bilingual editor.json (2.3 KB)

A picture supposedly being worth a thousand words, here is a working prototype/concept I quickly put together.

Note that the English content goes in the tiddler’s standard “text” field, and the French content goes into the tiddler’s “text-fr” field.

I’d prefer change that so the English content goes into a “text-en” field to put the languages on equal footing. Not done in this concept prototype because I didn’t feel like putting in the extra 15 minutes. Yeah, I’m already past my bedtime …

1 Like

Charlie, Very nice. The only thing I’d change is using <$edit-text widget with the parameter tag=textarea instead of the text-widget. This will allow multiline text on both sides.

The text-fr field name should be more generic eg: text-l2 where l2 stands for language-2 which then can be any-language :wink:

Then the default display of the text-l2 field should be hidden, to avoid confusion.

Additionally I would add my uni-link plugins “alias function” so linking in both languages can be done using the native language, without the need to write “complicated” pretty-links. … Aliases are also immune against tiddler title changes, which may be handy here.

That’s absolutely right.

For the ViewTemplate I personally would prefer a 3-way switch. eg:

  • Show L1 only
  • Show L2 only
  • Show both side by side … similar to the editor

I was thinking generic such that if you later wanted to add a third language, maybe a fourth, and so on.

Hard to tell which is which with “text-l2”, “text-l3”, “text-l4”, and so on.

But that’s me. Depends on the intent, and depends on whatever floats a person’s boat.

Good lord, that was put together very quickly and dirtly(?) as a proof of concept prototype, not as a solution. It could be the start of a solution, or a throw away to be replaced with a substantially different approach (grid instead of table, responsive divs, whatever.)

I expect there are all sorts of things that need to change. The French-language panel on the right side was just a copy-paste of the already existing related code for what is showing on the left side.

There are a ton of things I’d be doing to that, like collapsing either panel to give more space when doing a preview of one panel, etc.

If other languages are needed, then I’d be setting up a way to always show just two languages side-by-each, but an interface to switch which two languages are visible in either pane.

So one might tweak the French on the right side to match the English on the left side, then make the left side show Spanish, so that I can make the Spanish match the French, etc. etc.

1 Like

Nice Brainstorming! …

There also is the problem, if a text only exists in 1 language but not in the second one. … We need a fallback to the “base-language” here.

So let’s say English is the base language and the French one doesn’t exist yet, the English text will be shown for both “global” language settings. … A similar mechanism as the TW-UI does it.

For the language code we can use the full code eg: de-DE, de-AT, fr-FR and so on. So it would be possible to switch the UI language and the ViewTemplate language with 1 setting, if that is desirable.

1 Like

I’d say a fallback “something”.

For a native speaker of a particular language, it can sometimes be insulting to have English thrown at you when something hasn’t been translated yet.

So a fallback of some kind that doesn’t treat a language like a second, or third, or fourth, etc. class citizen.

Well, if somebody is going to get their panties in a bunch over anything, nothing is going to help.

But options are good. Not just throw a bunch of content in a fallback language, but maybe also offer an opportunity to see that content in Google Translate, along with a statement of apology that the translation is pending, blah blah blah …

It depends on the scope of: audience, content, legal requirements, touchiness of subject matter, ad infinitum ad nauseum …

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.