1

我正在使用 l20n.js 为 Angular 应用程序提供本地化。它适用于 index.html 中的元素,但本地化文本不会显示在 Angular 局部视图中。这是我的项目结构:

<!--app/index.html-->
<!doctype html>
<html>
<head>
<script src="bower_components/angular/angular.js"></script>
<link rel="localization" href="locales/manifest.json">
<script src="bower_components/l20n/l20n.js"></script>
</head>
<p data-l10n-id="about"></p>
<!--This is where partial.html gets rendered-->
<p ng-view=""></div>
</html>

<!--app/locales/en-US/strings.l20n-->
<pass "This text is rendered in the browser">
<fail "This text doesn't show up at all">

<!--app/views/partial.html-->
<p>This text is being displayed, so I know the partial view is being rendered.</p>
<p data-l10n-id="fail"></p>

我目前的工作理论是存在某种竞争条件;Angular 正在重新渲染某些东西,l20n 没有意识到发生了重新渲染,也没有从资源文件中获取翻译后的文本。我怎样才能解决这个问题?

4

0 回答 0