Angular-翻译器不工作(useStaticFilesLoader)
Angular-translator not working ( useStaticFilesLoader )
我在 mean.js 中使用 Angular-translate(PascalPrecht 模块)和 StaticFilesLoader。但是在浏览器控制台中出现错误,
http://localhost:1234/app/languages/es.json 404(未找到)
而且翻译不工作。
我尝试了其他网站上的所有选项,但我的问题仍然存在。谁能建议如何在 mean.js
中设置 json 文件的路径
这是我的代码
public/module/user/config.js
$translateProvider.useStaticFilesLoader({
prefix: 'app/languages/',
suffix: '.json'
});
$translateProvider.preferredLanguage('es');
我在 app/languages/es 中设置了我的 json 文件。json
{ "TITLE": "Hello", "SUBJECT": "this is it" }
如果不查看整个应用程序结构,很难确定这一点。您的目录 "app" 位于何处?如果您尝试打开 http://localhost:1234/app/languages/es.json in your browser address bar, does it work? What is the URL for config.js? If it's: http://localhost:1234/module/user/config.js 那么我相信您只需要将 app/languages 树移动到 'public'.
下
我在 mean.js 中使用 Angular-translate(PascalPrecht 模块)和 StaticFilesLoader。但是在浏览器控制台中出现错误,
http://localhost:1234/app/languages/es.json 404(未找到)
而且翻译不工作。 我尝试了其他网站上的所有选项,但我的问题仍然存在。谁能建议如何在 mean.js
中设置 json 文件的路径这是我的代码
public/module/user/config.js
$translateProvider.useStaticFilesLoader({
prefix: 'app/languages/',
suffix: '.json'
});
$translateProvider.preferredLanguage('es');
我在 app/languages/es 中设置了我的 json 文件。json
{ "TITLE": "Hello", "SUBJECT": "this is it" }
如果不查看整个应用程序结构,很难确定这一点。您的目录 "app" 位于何处?如果您尝试打开 http://localhost:1234/app/languages/es.json in your browser address bar, does it work? What is the URL for config.js? If it's: http://localhost:1234/module/user/config.js 那么我相信您只需要将 app/languages 树移动到 'public'.
下