Strings for translation

Everything related to the development of modules in jamovi
Post Reply
User avatar
yurismol
Posts: 19
Joined: Sat May 27, 2023 6:40 am
Location: Chita
Contact:

Strings for translation

Post by yurismol »

Dear module developers!
Can you enclose text output strings in .("Some String") function symbols?
Only in *.b.R files.
This makes it easier to translate your modules into other languages.
P.S. I think Jonathon will agree with me.
User avatar
jonathon
Posts: 2818
Joined: Fri Jan 27, 2017 10:04 am

Re: Strings for translation

Post by jonathon »

Hi Yuri,

Yes, in order to translate modules, you can surround your text with the .() function as you describe.

Is that what your asking? I feel like i'm not answering your question, sorry!

jonathon
User avatar
yurismol
Posts: 19
Joined: Sat May 27, 2023 6:40 am
Location: Chita
Contact:

Re: Strings for translation

Post by yurismol »

I just ask other module developers to do this
sbalci
Posts: 133
Joined: Sat Jan 06, 2018 10:25 pm
Contact:

Re: Strings for translation

Post by sbalci »

Would you please give an example.
User avatar
yurismol
Posts: 19
Joined: Sat May 27, 2023 6:40 am
Location: Chita
Contact:

Re: Strings for translation

Post by yurismol »

For example (in *.b.R file):
matrix$addFootnote(rowNo=i, paste0(colVarName, '[r]'), .('Pearson correlation cannot be calculated for non-numeric values'))
or
nm <- jmvcore::format(.('Matrix #{i}'), i=nCl)

You need to add importFrom(jmvcore,.) to NAMESPACE file first

+ If you want make a translation file:
jmvtools::i18nCreate("langcode")
and
jmvtools::i18nUpdate("langcode")
after making changes
sbalci
Posts: 133
Joined: Sat Jan 06, 2018 10:25 pm
Contact:

Re: Strings for translation

Post by sbalci »

Thank you
DStuder
Posts: 16
Joined: Wed Jun 07, 2023 8:07 am

Re: Strings for translation

Post by DStuder »

Seems like a good idea. I've been trying to do exactly that but have struggled with it as I could not find any information on how to add translation to a module. It would be immensely helpful if this topic would be explained in the official jamovi documentation on module development: https://docs.jamovi.org/_pages/developer-hub.html. I'm sure yurismol or someone else from the community could help with writing the documentation?
User avatar
yurismol
Posts: 19
Joined: Sat May 27, 2023 6:40 am
Location: Chita
Contact:

Re: Strings for translation

Post by yurismol »

DStuder wrote: Thu Apr 24, 2025 1:22 pm Seems like a good idea. I've been trying to do exactly that but have struggled with it as I could not find any information on how to add translation to a module. It would be immensely helpful if this topic would be explained in the official jamovi documentation on module development: https://docs.jamovi.org/_pages/developer-hub.html. I'm sure yurismol or someone else from the community could help with writing the documentation?
I can, but I think Jonathon would do it better.
Post Reply