feat(SW-2333): I18n for multiple apps and packages * Set upp i18n in partner-sas * Adapt lokalise workflow to monorepo * Fix layout props Approved-by: Linus Flood
36 lines
965 B
TypeScript
36 lines
965 B
TypeScript
import fs from 'fs-extra'
|
|
import path from 'path'
|
|
|
|
// Get the list of apps from command-line arguments
|
|
const apps = process.argv.slice(2)
|
|
|
|
if (apps.length === 0) {
|
|
console.error('Please provide at least one app name.')
|
|
process.exit(1)
|
|
}
|
|
|
|
// Update the source directory to the correct path
|
|
const sourceDir = path.resolve(process.cwd(), 'scripts/i18n/dictionaries')
|
|
|
|
if (!fs.existsSync(sourceDir)) {
|
|
console.error(`Source directory does not exist: ${sourceDir}`)
|
|
process.exit(1)
|
|
}
|
|
|
|
// Iterate over each app and copy the dictionaries folder
|
|
apps.forEach((app) => {
|
|
const targetDir = path.resolve(process.cwd(), `apps/${app}/i18n/dictionaries`)
|
|
|
|
try {
|
|
// Ensure the target directory exists
|
|
fs.ensureDirSync(targetDir)
|
|
|
|
// Copy the dictionaries folder
|
|
fs.copySync(sourceDir, targetDir)
|
|
|
|
console.log(`Copied dictionaries to ${targetDir}`)
|
|
} catch (error) {
|
|
console.error(`Failed to copy dictionaries to ${targetDir}:`, error)
|
|
}
|
|
})
|