Weblate 前端¶
前端当前使用 Bootstrap、jQuery 和一些第三方库来构建。
依赖性管理¶
yarn 软件包管理工具用于更新第三方库。配置在 scripts/yarn
中,并且有个打包脚本 scripts/yarn-update
来更新库,构建它们,并复制到 weblate/static/vendor
中的正确位置上,所有的第三方前端膘满都位于那里。
本地化¶
如果在前端代码中需要任何用户可见的文本,那么应该将其本地化。在多数情况下,所有需要的是将文本打包到 gettext
函数内部,但也有更复杂的特性来使用:
document.write(gettext('this is to be translated'));
var object_count = 1 // or 0, or 2, or 3, ...
s = ngettext('literal for the singular case',
'literal for the plural case', object_count);
fmts = ngettext('There is %s object. Remaining: %s',
'There are %s objects. Remaining: %s', 11);
s = interpolate(fmts, [11, 20]);
// s is 'There are 11 objects. Remaining: 20'
图标¶
Weblate 当前使用 material design 图标,在寻找照新图标的情况下,请查看 <https://materialdesignicons.com/>。
此外,有 scripts/optimize-svg
来减小 SVG 的大小,因为多数图标嵌入在 HTML 中,而使路径有风格。