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

Has anyone actually be able to make this work? #48

Open
mfalconi-perle opened this issue Jan 10, 2024 · 2 comments
Open

Has anyone actually be able to make this work? #48

mfalconi-perle opened this issue Jan 10, 2024 · 2 comments

Comments

@mfalconi-perle
Copy link

Does anything other than the CLI actually work for this? Even that is broken and doesnt parse valid html.

@ParvinEyvazov
Copy link
Member

Hello @mfalconi-perle,

I am sorry, I didn't get what you mean. Can you please share more detailed information?

@mfalconi-perle
Copy link
Author

Hello @mfalconi-perle,

I am sorry, I didn't get what you mean. Can you please share more detailed information?

Error: Command failed: jsontt C:\Users\username\Desktop\websites\site\site\wwwroot\JSON\Applications_Solutions\Broadcasting\bbc.json --module bing --from en --to de --name C:\Users\MichaelFalconi\Desktop\websites\perlesystems.de\perlesystems.de\wwwroot\JSON\Applications_Solutions\Broadcasting\it-helpdesk-use-ethernet-extenders --fallback yes --concurrencylimit 10
undefined:1
{
^

SyntaxError: Unexpected token '', "{
  "Met"... is not valid JSON
const translator = require('@parvineyvazov/json-translator');
let fs = require('fs');
const util = require('node:util');
const exec = util.promisify(require('node:child_process').exec);

async function genFiles(){
  let path = 'C:\\Users\\username\\Desktop\\websites\\site\\site\\wwwrootJSON\\Applications_Solutions';
  let SubDirs = fs.readdirSync(path);
  for(i = 0; i < SubDirs.length; i++)
  {
    console.log(SubDirs[i]);
    if(SubDirs[i] != "template.json"){
      let files = fs.readdirSync(`${path}/${SubDirs[i]}`);
      for(j = 0;j < files.length; j++)
      {
        let s = `${path}\\${SubDirs[i]}\\${files[j]}`;
        s = s.replace("/", "\\");
        console.log(`translating: ${s}`)        
        let outpath = `C:\\Users\\username\\Desktop\\websites\\perlesystems.de\\perlesystems.de\\wwwroot\\JSON\\Applications_Solutions\\${SubDirs[i]}\\${files[i]}`;
        outpath = outpath.replace(".json", "");
        const { stdout, stderr } = await exec(`jsontt ${s} --module bing --from en --to de --name ${outpath} --fallback yes --concurrencylimit 10`);
        console.log(stdout)
        console.log(stderr)        
      }      
    }
  }
}
genFiles();

Whether i run the above code or use the CLI i get invalid JSON error, or Cannot save file errors. I have validated the json with other tools and know for a fact is valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants