Home / GitHub Page

Building Translation


#1

I thought that I could do translation but once the file CliClient/locales/fr_FR.po modified (with poedit), the build does not update the strings I modified.

I follwed that

Building the tools
Before building any of the applications, you need to build the tools:

cd Tools
npm install
Building the Electron application
cd ElectronClient/app
rsync --delete -a ../../ReactNativeClient/lib/ lib/
npm install
yarn dist

then I run the version I have in dist folder but I dont have my translations :confused:


#2

Right, that’s because you would need to run node Tools/build-translations.js to update all the relevant files. That would basically create some JSON files, which is what the apps use for translation.


#3

I may have two left hand because I cant run it

node Tools/build-translation.js 
module.js:549
    throw err;
    ^

Error: Cannot find module 'sprintf-js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/foxmask/DjangoVirtualEnv/joplin/ReactNativeClient/lib/locale.js:1:83)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

if I really need the missing module, npm search sprintf-js displays a lot of things, which one should I install?


#4

I did

npm install sprintf-js 
aptitude install translate-toolkit

then modified the file CliClient/locales/fr_FR.po but the process of compiling, add ‘# ~’ in front of any translation string I added.

I’m reading Tools/build-translations.js to try to understand at wat moment my added translation are removed but it’s not clear yet :slight_smile:

edit: I noticed that the translation were grabbed from the github repo, so I replaced in

function poFileUrl(locale) {
	// return 'https://github.com/laurent22/joplin/blob/master/CliClient/locales/' + locale + '.po';
	return 'CliClient/locales/' + locale + '.po';
}

In the meantime I spotted a typo in that file too …
Once I could find how the process works I hope submit a PR :slight_smile:


#5