Merged in feat/sw-2333-package-and-sas-i18n (pull request #2538)
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
This commit is contained in:
35
scripts/i18n/distribute.ts
Normal file
35
scripts/i18n/distribute.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user