final_fix_braces.js 887 B

1234567891011121314151617181920212223242526
  1. const fs = require('fs');
  2. const path = require('path');
  3. const translationsPath = path.join('d:', 'workspace', 'AuraK', 'web', 'utils', 'translations.ts');
  4. let content = fs.readFileSync(translationsPath, 'utf8');
  5. // The file should end with ja object closing and then main object closing.
  6. // Current last line: }; // end of translations
  7. // We want:
  8. // },
  9. // };
  10. // Strip potential trailing whitespace or comments that might mess up endsWith
  11. const lines = content.trimEnd().split('\n');
  12. const lastLine = lines[lines.length - 1];
  13. if (lastLine.includes('};')) {
  14. console.log('Found closing brace at the end. Fixing...');
  15. lines[lines.length - 1] = ' },';
  16. lines.push('};');
  17. fs.writeFileSync(translationsPath, lines.join('\n') + '\n', 'utf8');
  18. console.log('Fixed end of file.');
  19. } else {
  20. console.log('Closing brace not found as expected. Last line:', lastLine);
  21. }