本文介绍了我可以获取特定词典的整个i18n标签吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我面临i18n标签的问题。 I am facing an issue with i18n labels. 我的应用程序使用Granite.I18n.get(’’)函数在js前端读取了几个i18n标签。按照 /etc/clientlibs/foundation/shared/source/init.js中的要求,整个字典都以 /libs/cq/i18n/dict.{+locale}.json的形式下载。 My application reads few i18n labels at js frontend using Granite.I18n.get('') function. The entire dictionary gets downloaded as ‘/libs/cq/i18n/dict.{+locale}.json’ as dictated in ‘/etc/clientlibs/foundation/shared/source/init.js’. 现在,en字典仅返回自定义标签,并且尺寸较小。 但是其他语言(例如fr),字典文件是所有/ libs字典的聚集,并且非常大。我在其他一些站点中也注意到了这一点。Now the en dictionary returns only the custom labels and is small size.But other languages like fr,the dictionary file is aggregation of all /libs dictionary and is very huge. I noticed this in few other sites also. 词典-118 KB 法语词典-1.4 MB Timewarnercable.com Timewarnercable.com 字典-1.1 KB 法语词典-1.2 MB Thermofisher Thermofisher 字典-3 KB 法语词典-69 5 KB 我们的痛点是,在CDN上缓存此重文件的成本增加,并试图找到减少CDN的方法成本。 Our pain point with this is, cost of caching this heavy file at CDN increases and trying to find a way to reduce CDN cost. 我知道标签本身就是关键。但是ExportServlet只能过滤en的渲染自定义词典。我们的字典类似于/ libs下的otb字典。那么,ExportServlet如何在en export下处理otb标签呢? I understand en labels are the key itself. But the ExportServlet is able to filter out the render custom dictionary only for en. Our dictionaries are similar to otb dictionaries under /libs. Then how come ExportServlet treat otb labels under en export? 此错误在所有CMS产品中都是常见的还是特定于Adobe的吗?还需要一种解决方案或解决方法来仅获取其他语言的自定义词典。 Is this bug common in all CMS products or specific to Adobe? Also need a solution or workaround to get custom dictionary only for other languages. 推荐答案我最终编写了一个自定义实现,因为在这个问题上我也没有从Adobe票务中获得太多帮助。 I ended up writing a custom implementation as I didnt get much help from Adobe tickets as well on this issue. OTB字典json是由ResourceBundleExportServlet呈现的。 我创建了一个自定义的悬吊servlet,它将准备并返回类似于ResourceBundleExportServlet的json 修改了/etc/clientlibs/granite/utils/source/I18n.js来调用自定义servlet而不是otb servlet。 自定义servlet被编码为仅返回特定的数据字典,而不是所有字典。 OTB dictionary json is rendered by ResourceBundleExportServletI created a custom sling servlet that ll prepare and return json similar to ResourceBundleExportServletModified /etc/clientlibs/granite/utils/source/I18n.js to call the custom servlet rather than otb servlet. Custom servlet is coded to return only specific data dictionary and not all dictionaries. 这解决了我的问题。虽然不被认为是适当的解决方案。需要有一种otb方式来使其变得干净。 This solved my problem. Though am not convinced as proper solution. There needs to an otb way of rendering this clean. 这篇关于我可以获取特定词典的整个i18n标签吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-16 20:07