Closed wolframm closed 1 year ago
Hello,
attranslate itself does not have a solution at the moment, but there are a few options to workaround this error:
For example, something like the following postprocessing script could be used (not tested, taken from ChatGPT):
const fs = require('fs');
const filePath = 'path/to/your/spanish/file.yaml';
const searchStr = '$valor';
const replaceStr = '$value';
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error(err);
return;
}
const result = data.replace(new RegExp(searchStr, 'g'), replaceStr);
fs.writeFile(filePath, result, 'utf8', (err) => {
if (err) {
console.error(err);
return;
}
console.log(`File "${filePath}" updated successfully.`);
});
});
I switched to using ARB-format instead of YAML. The error does not appear when working with ARB.
Thank you for attranslate, by the way. Apparently it does the same job as using expensive websites like lokalise.com or localizely.com!
Okay please let me know if something else needs fixing with regard to the output-files!
Theoretically, your original YAML-error could be fixed by expanding the already existing "--keySearch/--keyReplace"-feature, but I am not sure whether this would bring any improvement over customized postprocessing-scripts.
Description
Using following YAML-file definition:
Running the following script:
Generates the following, correct YAML in German...
...and the following, faulty YAML in Spanish, where the variable
$value
suddenly shows up as$valor
:Expected behavior The Spanish YAML should look as follows: