Add internationalization support and build process for multiple languages

- Implemented a build script to compile i18n files and copy them to the docs directory.
- Added compiled i18n files for Arabic, Czech, Spanish, Persian, French, Indonesian, Polish, Russian, Turkish, Vietnamese, and Traditional Chinese.
- Created an HTML file to demonstrate the usage of Artplayer with i18n support, including language options and a sample video.
This commit is contained in:
Harvey Zack committed 2025-08-17 13:18:08 +08:00
1 parent 09aab497ac
commit 0c0bcecb9e
13 files changed
+68 -1

No files matched your search

+3 -1
View File
@@ -2,11 +2,13 @@ import fs from 'node:fs'
import path from 'node:path'
import process from 'node:process'
import { Parcel } from '@parcel/core'
import cpy from 'cpy'
import { glob } from 'glob'
const basePath = 'packages/artplayer'
const i18nSrcDir = path.join(basePath, 'src/i18n')
const distDir = path.join(basePath, 'dist/i18n')
const compiledPath = path.resolve('docs/compiled/i18n')
const entries = glob.sync('*.js', {
cwd: i18nSrcDir,
@@ -42,7 +44,7 @@ const entries = glob.sync('*.js', {
const { bundleGraph, buildTime } = await bundler.run()
const bundles = bundleGraph.getBundles()
console.log(`✨ Built [i18n] ${bundles.length} bundles in ${buildTime}ms`)
bundles.forEach(b => console.log('📦 Output:', b.filePath))
await cpy(distDir, compiledPath)
}
catch (err) {
console.error('❌ Build i18n failed.')