generate pot. file to translate a module analysis, results and ui ?

Everything related to the development of modules in jamovi
Post Reply
jcthrawn
Posts: 5
Joined: Fri Jul 26, 2024 1:49 pm

generate pot. file to translate a module analysis, results and ui ?

Post by jcthrawn »

Hi,

I want to translate a Jamovi module I'm making in french for my students, but I wonder : is there a simple way to generate a pot. file containing all analysis, results and ui options (titles, descriptions and labels), like the ones in jmv/jamovi/i18n ? I thought about using yaml::read_yaml() to build it manually, but I guess there are more straightforward approaches.

Brice
User avatar
jonathon
Posts: 2847
Joined: Fri Jan 27, 2017 10:04 am

Re: generate pot. file to translate a module analysis, results and ui ?

Post by jonathon »

ah, we definitely have this functionality, but i don't think we've surfaced it in jmvtools ... in order to do it, you'll have to invoke the "jamovi compiler" directly. here's the usage info for the compiler:

Code: Select all

    let usage = 'Usage:\n';
    usage += '    jmc --build path\n';
    usage += '    jmc --prepare path\n';
    usage += '    jmc --install path     [--home path]\n';
    usage += '    jmc --check            [--home path]\n';
    usage += '\n';
    usage += '    jmc --i18n path  --create code     [--verbose]\n';
    usage += '                     --update [code]   [--verbose]\n';
so i think you'll want

jmc --i18n path/to/your/module --create fr

however, unless you install the compiler as a global node module, you won't be able to just call 'jmc', rather you'll want to use:

path/to/node path/to/compiler-index.js --i18n path/to/your/module --create fr

to figure out the paths here, you can use the commands (from R, with jmvtools installed), node::node() and jmvtools:::jmcPath() (note that you have to use three colons in jmvtools:::jmcPath()).

jonathon
jcthrawn
Posts: 5
Joined: Fri Jul 26, 2024 1:49 pm

Re: generate pot. file to translate a module analysis, results and ui ?

Post by jcthrawn »

Hi Jonathon,

Thank you very much, I'll try it right now ! 

Brice
Post Reply