SAP Spartacus internationalization ( i18n ) 翻译问题的排错指南
有 partners 在使用 SAP Spartacus 进行二次开发时,遇到这个警告消息:Translation key missing ‘common.search’ in the chunk ‘common’ in file spartacus-core.js
看我的解答:
Hi there,
if you would like to use cxTranslate pipe, make sure you import I18nModule from @spartacus/core and add it in the import section of your AppModule:
Here below is tips about trouble shooting i18n issues.
In my app.module.ts I use B2cStorefrontModule.withConfig to pass my application specific configuration. In Chrome Development Tool, I set breakpoint on line 82:
then in the runtime when the breakpoint is triggered, you can check in debugger, to inspect whether a given translation key, like “common.search” in your case exsts or not. If not exist, you will meet with error message mentioned in this thread.
I am testing based on Spartacus version 2.1 and I didn’t find there is translation key “search” under common chunks, as see in highlighted area above.
I just manually added a custom translation key via:
function provideAdditionaLanguage(translations: TranslationResources) {
translations[“en”].common.common.jerrysearch = “Jerry Search”;
return translations;
}
and configure it in AppModule below:
Then consume it in my page:
final result,it works:
更多Jerry的原创文章,尽在:“汪子熙”:
SAP Spartacus internationalization ( i18n ) 翻译问题的排错指南相关推荐
- SAP Spartacus internationalization(i18n) 的实现 - 关于多语言,翻译支持的实现
通过自定义pipe cxTranslate完成: 加上这行console.log语句: 可以看到最后的翻译输出结果: 要获取更多Jerry的原创文章,请关注公众号"汪子熙":
- 如何让SAP Spartacus的非英语页面正常显示
如下图所示,当修改Spartacus的语言成德语时,我们在界面上看到很多用大括号包裹起来的占位符,这些占位符是Spartacus internationalization(i18n)支持的resour ...
- SAP Spartacus UI Duplicated keys has been found in the config of i18n chunks
在测试 SAP Spartacus 3.4.5 版本的 SSR 功能时,发现一个 warning 信息: console.warn(`Duplicated keys has been found in ...
- 给SAP Spartacus B2B list增加用户提示信息
本需求来自Github issue: https://github.com/SAP/spartacus/issues/9991 具体实现: 在负责维护多语言的翻译文件里,增添对应的文本信息: 使用re ...
- SAP Spartacus 手动开启服务器端渲染 (SSR) 所必须的步骤
使用服务器端渲染,我们可以保证搜索引擎,与浏览器的Javascript禁用,或没有JavaScript的浏览器仍然可以访问我们的网站内容. https://b2bspastore.cg79x9wuu9 ...
- SAP Spartacus User form通过label标签的实现原理
第一次见到这个有点诧异,居然是通过label实现的: 上述页面可以从SAP Spartacus User list,点击某个user进入明细页面开始编辑: 看到这个ng-reflect-name=ro ...
- Jerry在2020 SAP全球技术大会的分享:SAP Spartacus技术介绍的文字版
这是Jerry 2020年的第86篇文章,也是汪子熙公众号总共第268篇原创文章. 这篇文章的视频版本如下: https://v.qq.com/x/page/b3212l6kqvg.html 这个分享 ...
- SAP Spartacus 3.0 的一些变化
SAP Spartacus 确实使用到了Bootstrap这个框架: Technical Changes in Spartacus 3.0 Breaking Changes Translations ...
- SAP Spartacus 4.0 版本因为 hamburger 依赖导致构建出错的问题
build from Schematics 遇到错误消息: SassError: Undefined function. https://github.com/SAP/spartacus/issues ...
最新文章
- 「软件」2.0时代已经到来,你需要这样的开发工具
- Windows Server 2012 R2上Compact/Shrink vhdx
- 5码默认版块_5个小众的生活学习类的宝藏App
- 309. Best Time to Buy and Sell Stock with Cooldown
- WINCE下I/O操作基础
- php ci model条件查询,php – CodeIgniter中的多条件WHERE子句
- python可以做exe文件吗_手动制作python的exe可执行程序
- C语言再学习-- 大端小端详解(转)
- 一个手机用c网可以打开网站切换到g网就打不开_推荐一些设计师常用网站!!!...
- 对象存储是什么?看过就明白了
- [每天一个知识点]25-职业生涯-核桃皮是当水果吃好还是当蔬菜吃好?
- R plot图片背景设置为透明_CAD2020图形布局输出到打印机、绘图仪,保存和恢复布局的打印设置 - AutoCAD问题库...
- Photoshop CS6 序列号完美激活教程
- 自学Linux 2—Linux 的系统架构之 Linux 内核的主要模块和 Linux 的文件结构
- 【WebAPI 验证】给 webapi加上token 验证(包括上传文件方法)
- Quartz2D学习记录
- 卡券php小程序,微信小程序领取卡券 - osc_88a08cel的个人空间 - OSCHINA - 中文开源技术交流社区...
- javaCV入门指南:调用FFmpeg原生API和JavaCV是如何封装了FFmpeg的音视频操作?
- CentOS7 搭建企业级NFS网络文件服务器
- 职中计算机基础应用期中试题,职中计算机应用基础期中考试试题及答案
热门文章
- kudu 存储引擎简析
- 使用mount挂载一个windows的共享
- apache 工作模式prefork进程模式和worker线程模式参式详解和推荐设置
- [项目过程中所遇到的各种问题记录]编辑器篇——FCKeditor自定义上传路径配置...
- QQ2007退出市场
- 分享下多年积累的对JAVA程序员成长之路的总结
- 从零写一个编译器(九):语义分析之构造抽象语法树(AST)
- redis 系列26 Cluster高可用 (1)
- Jupyter 安装并配置工作路径[转]
- python元编程之使用动态属性实现定制类--特殊方法__setattr__,__getattribute__篇