1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
| // 文化规则引擎
class CultureRulesEngine {
private rules = new Map<string, CultureRule>();
constructor() {
this.loadRules();
}
// 加载文化规则
private loadRules(): void {
// 颜色禁忌
this.addRule('color.taboo', {
'CN': ['white'], // 中国:白色(丧事)
'JP': ['black'], // 日本:黑色
'SA': ['yellow'], // 沙特:黄色
});
// 数字禁忌
this.addRule('number.taboo', {
'CN': [4], // 四
'JP': [4, 9], // 四、九
'US': [13],
'KR': [4],
});
// 图像规范
this.addRule('image.restrictions', {
'IN': { // 印度
avoid: ['cows', 'religious_symbols'],
require: ['modest_clothing']
},
'AE': { // 阿联酋
avoid: ['alcohol', 'gambling', 'pork'],
require: ['modest_clothing', 'halal_certification']
}
});
// 节假日
this.addRule('holiday', {
'CN': ['spring_festival', 'mid_autumn', 'national_day'],
'US': ['christmas', 'thanksgiving', 'independence_day'],
'JP': ['golden_week', 'obon'],
'KR': ['seollal', 'chuseok'],
});
}
// 检查是否适合目标文化
checkCulturalFit(content: any, targetRegion: string): CulturalFitReport {
const issues: CulturalIssue[] = [];
// 检查颜色
if (content.colors) {
const colorTaboos = this.getRule('color.taboo', targetRegion) || [];
for (const color of content.colors) {
if (colorTaboos.includes(color)) {
issues.push({
type: 'color',
severity: 'warning',
message: `Color ${color} may be inappropriate in ${targetRegion}`,
suggestion: `Consider alternative colors`
});
}
}
}
// 检查数字
if (content.numbers) {
const numberTaboos = this.getRule('number.taboo', targetRegion) || [];
for (const num of content.numbers) {
if (numberTaboos.includes(num)) {
issues.push({
type: 'number',
severity: 'info',
message: `Number ${num} has negative connotations in ${targetRegion}`,
suggestion: `Consider using ${num + 1} or ${num - 1}`
});
}
}
}
// 检查图像
if (content.images) {
const restrictions = this.getRule('image.restrictions', targetRegion);
if (restrictions) {
for (const image of content.images) {
for (const avoid of restrictions.avoid) {
if (image.tags?.includes(avoid)) {
issues.push({
type: 'image',
severity: 'error',
message: `Image contains culturally sensitive content: ${avoid}`,
suggestion: `Remove or replace this image`
});
}
}
}
}
}
return {
compatible: issues.filter(i => i.severity === 'error').length === 0,
issues,
score: this.calculateScore(issues)
};
}
}
|