One more failed attempt
create $:/languages/ru-RU/plugins/vendor/plugin/Language/Node/Text with
translated text
create tiddler to hold translation macro
```
tags: $:/plugins/vendor/plugin/Macros
title: $:/plugins/vendor/plugin/Language
type: text/vnd.tiddlywiki
\define translate(path)
<$macrocall $name="_translate" language={{$:/language}} path="$path$"/>
\end
\define _translate(language, path)
{{$language$/plugins/vendor/plugin/Language/$path$}}
\end
```
It can be used as
```
<$importvariables filter="[tag[$:/plugins/vendor/plugin/Macros]]">
<<translate Note/Text>>
</$importvariables>
```
Again it cannot be used in widgets. Following will not work
```
<$importvariables filter="[tag[$:/plugins/vendor/plugin/Macros]]">
<$edit-text
tiddler="$:/temp/idea"
field="provisory_title"
placeholder=<<translate Note>>
tag="input" class="tw-edit-texteditor"/>
</$importvariables filter="[tag[$:/plugins/vendor/plugin/Macros]]">
```
Best regards,
iilyak
On Monday, November 12, 2018 at 1:46:48 PM UTC-8, ILYA Khlopotov wrote:
>
> I am completely lost with plugin translations.
>
> The core has `lingo` macro. So I tried to use it as follows:
>
> languages/ru-RU/Note.multids:
> ```
> title: $:/language/plugins/plugin_vendor/plugin_name/
>
> Note: New Note
> ```
>
> I used it in tiddlers as follows
> ```
> \define lingo-base() $:/language/plugin_vendor/plugin_name/
>
> <<lingo Note>>
> ```
>
> This seem to work at first. However when I added more translations only
> one was always selected. The values were overwritten because all
> translations are mapped to the same tiddler. I found another problem with
> this approach it didn't work inside widgets. For example following syntax
> didn't work
> ```
> <$edit-text
> tiddler="$:/temp/idea"
> field="provisory_title"
> placeholder=<<lingo Note>>
> tag="input" class="tw-edit-texteditor"/>
> ```
>
> So I came to a conclusion that lingo macro is internal thing which is not
> supposed to be used in plugins (I could be wrong).
>
> Therefore I need to find another way to achieve my goal (bundle plugin
> with multiple translations). I think I should rely on the value returned by
> `$:/language/`, but I don't know how to write a macro which would
> concatenate the result returned by `$:/language/` with path to namespace of
> the plugin. I thought to store translation tiddlers under either:
> - `$:/language/ru_RU/plugins/plugin_vendor/plugin_name/Note.multids`
> - `$:/plugins/plugin_vendor/plugin_name/languages/ru-RU/Note.multids`
>
> Macro is a simple text substitution so it doesn't get the value of
> `$:/language/`. Do I need:
> - a nested transclusion syntax
> - use of macrocall
> - use set or vars widget
>
> Best regards,
> iilyak
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/03606d74-168d-44c7-b0ea-fe122b257eff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.