我想把一个文本通过翻译管,但文本是在css中的内容。
.files:before {
position: absolute;
content: "Drag your files here";
}
这是行不通的。
.files:before {
position: absolute;
content: {{'file.text' | translate}};
}
不知道这是否可行。
通过使用管道,你可以改变HTML部分的内容,所以只需绑定到DOM中的某个属性,然后试着从那里读取css,就像这样--。
.files:before {
position: absolute;
content: attr(data-lang)
}
例如,你有一个DOM元素,你需要添加数据属性,就像下面提到的--。
<p data-lang="en">Any content here </p>