retejs / rete.js.org

Examples and documentation for Rete.js v1
http://rete.js.org
35 stars 29 forks source link

English translations are not shown correctly #3

Closed Mokkapps closed 5 years ago

Mokkapps commented 5 years ago

The English translations on the website are not shown correctly, especially in the "Learning" section:

screenshot 2019-01-25 at 21 43 55

Do you need help with the translations? I can help to implement them but I am no native speaker ;-)

Or does it maybe make sense to just link to: https://rete.readthedocs.io/en/latest/

This is the maintained docs version, or?

Ni55aN commented 5 years ago

The translations in Docs missing, but we can easily add it as much as possible.

Do you need help with the translations? I can help to implement them but I am no native speaker

It'd be cool! I have some problems with grammar in English, so I am in no hurry to translate.

Or does it maybe make sense to just link to: https://rete.readthedocs.io/en/latest/

I'm not planning to maintain this

Ni55aN commented 5 years ago

I'm using this plugin for translations.

There is file for Docs translations, where first element of items' array - original text from textContent of HTMLElement (or sentence, splitted by a dot).

More common words or phrases should be placed in the root file

Mokkapps commented 5 years ago

Thanks, I am currently working on that.

One question: How would you structure the translation files, for example for the route docs/editor?

Ni55aN commented 5 years ago

@Mokkapps I think docs/editor.js with import to index.js will be enough

Mokkapps commented 5 years ago

I don't get it to work...

I have a docs/editor.js:

export default [   
    ["Редактор", {
        en: "Editor",
        ua: "Редактор"
    }],
    ["Редактор представляет собой область с узлами и соединениями между их сокетами", {
        en: "The editor is an area with nodes and connections between their sockets",
        ua: "Редактор представляет собой область с узлами и соединениями между их сокетами"
    }]
]

and this is the index.js:

import { assignSection } from '@/i18n';
import main from './main';
import editor from './editor';

export default () => assignSection([
  ...main,
  ...editor
], 'docs');

but the translations are not shown for the /docs/editor route.

Do you have any idea what I am doing wrong?

Ni55aN commented 5 years ago

@Mokkapps the v-t9n.deep="'docs'" directive should be added to the root element of component

Example components/Docs/Editor/index.vue:

<template lang="pug">
.editor(v-t9n.deep="'docs'")
  h1 Редактор
Ni55aN commented 5 years ago

I'll add it to all of components

Ni55aN commented 5 years ago

Done, now it should works properly

Mokkapps commented 5 years ago

@Ni55aN Yes, now it works. Thanks!

Mokkapps commented 5 years ago

Okay, I stumbled upon the next issue:

I cannot get this text in docs/enginetranslated:

В общем случае при каждом изиенении в схеме (узлы, соединения, данные узла) необходимо выполнять обработку

I tried it this way:

["В общем случае при каждом изиенении в схеме (узлы, соединения, данные узла) необходимо выполнять обработку", {
        en: "Consider the situation when, while working in the editor, you need to immediately receive the results of changes (this is easy to do with the 'process' event):",
        ua: "Рассмотрим ситуацию, когда во время работы в редакторе нужно сразу получать результаты изменений (это легко сделать с событием 'process')"
    }],

Also, all of translations before the mentioned line work fine. The whole file at the moment:

export default [   
    ["Этот класс позволяет обрабатывать данные на основе потоков в узлах и передавать их из выходных данных во входные", {
        en: "This class allows you to process data based on streams in nodes and transfer them from the output data to the input",
        ua: "Этот класс позволяет обрабатывать данные на основе потоков в узлах и передавать их из выходных данных во входные"
    }],
    ["Движок не зависит от других компонентов редактора", {
        en: "The engine does not depend on other components of the editor",
        ua: "Движок не зависит от других компонентов редактора"
    }],
    ["Все, что ему нужно - это идентификатор, воркеры Компонентов и JSON данные", {
        en: "All he needs is an identifier, component workers and JSON data",
        ua: "Все, что ему нужно - это идентификатор, воркеры Компонентов и JSON данные"
    }],
    ["Он может работать независимо от Редактора", {
        en: "It can work independently from the Editor.",
        ua: "Он может работать независимо от Редактора"
    }],
    ["Обработка", {
        en: "Treatment",
        ua: "Обработка"
    }],
    ["Обход узлов выполняется следующим образом:", {
        en: "Bypassing the nodes is performed as follows:",
        ua: "Обход узлов выполняется следующим образом:"
    }],
    ["Рассмотрим ситуацию, когда во время работы в редакторе нужно сразу получать результаты изменений (это легко сделать с событием 'process')", {
        en: "Consider the situation when, while working in the editor, you need to immediately receive the results of changes (this is easy to do with the 'process' event):",
        ua: "Рассмотрим ситуацию, когда во время работы в редакторе нужно сразу получать результаты изменений (это легко сделать с событием 'process')"
    }],
    ["В общем случае при каждом изиенении в схеме (узлы, соединения, данные узла) необходимо выполнять обработку", {
        en: "Consider the situation when, while working in the editor, you need to immediately receive the results of changes (this is easy to do with the 'process' event):",
        ua: "Рассмотрим ситуацию, когда во время работы в редакторе нужно сразу получать результаты изменений (это легко сделать с событием 'process')"
    }]
]

Any idea why it does not work?

Ni55aN commented 5 years ago

@Mokkapps did you pull my last commits?

I've checked it locally opera snapshot_2019-01-30_002546_localhost

Mokkapps commented 5 years ago

Yes, this translations on the screenshot works fine but the following lines make problems, as mentioned in my previous comment

Ni55aN commented 5 years ago

Yeah, I reproduced it. I'll investigate the issue later, for now I don’t know the reason

Ni55aN commented 5 years ago

I've fixed it. It was problem with multi line strings

Mokkapps commented 5 years ago

@Ni55aN Thanks, now I could finish and I have created a PR

Ni55aN commented 5 years ago

Another issue that I found:a period and a colon at the end of the sentence were required in translation. Now they are not required

Before:

["Lorem ipsum:", {}]

After:

["Lorem ipsum", {}]