Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translating by a little script #68

Open
Ananas0631 opened this issue Mar 26, 2024 · 1 comment
Open

Translating by a little script #68

Ananas0631 opened this issue Mar 26, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@Ananas0631
Copy link

Ananas0631 commented Mar 26, 2024

Hi there,i installed this plugin to use with a daily quote plugin.Daily quote plugin reedems a quote everyday.I have no problems understanding english but all my page is written with my native language and i don't want this quote in english language.It would be great for automatic creations/templates if you can provide this feature:

For example:

input:de[{{en_quote}}]

output:de_quote

(i am not a developer so i may have missed some things.Sorry about that.)

@Fevol
Copy link
Owner

Fevol commented Mar 27, 2024

Hi, I assume you are using the quote-of-the-day plugin. If so, you may be interested in this issue twentytwokhz/quote-of-the-day#10

In general, providing translations for a widget/view/... created by a plugin is not easily possible, as the translate plugin has no way to communicate with the other plugin (so translations/internationalisation has to be supported by the quote plugin itself)

If it helps, it is possible to create a translation script that uses this plugin using e.g. Templater like:

<%*
let engText = "Text to translate";
let sourceLanguage = "auto";  
let targetLanguage = "de";

const api = app.plugins.plugins['translate'].api;
if (api?.canTranslate) {  
	const output = await api.translate(engText, sourceLanguage, targetLanguage); 
	console.log(output)
	if (output.status_code !== 200)
	    new Notice(output.message);
	else
	    tR += output.translation;
}
%>

@Fevol Fevol self-assigned this Mar 27, 2024
@Fevol Fevol added the question Further information is requested label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants