我正在使用 l20n.js 向 Angular.js 应用程序添加本地化。这是我的项目结构:
/index.html
<!DOCTYPE html>
<html lang="en-US">
<head>
<script src="jquery-1.11.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"> </script>
<script src="trackingController.js"></script>
<script src="l20n.js"></script>
<link rel="localization" href="locales/manifest.json">
</head>
<body>
<h2 data-l10n-id="name"></h2>
<p data-l10n-id="instructions"></p>
</body>
</html>
/locales/manifest.json
{
"locales": [ "en-US", "fr-FR"],
"default_locale": "en-US",
"resources": [
"{{locale}}/strings.l20n",
]
}
/locales/en-US/strings.l20n
<name "Search by name - EN">
<instructions "Enter one or more names - EN">
/locales/fr-FR/strings.l20n
<name "Search by name - FR">
<instructions "Enter one or more names - FR">
如何将英语(即/locales/en/strings.l20n
文件)换成法语?尽管lang="fr-FR"
在index.html
.