@plotdb/srcbuild 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,7 +86,8 @@ Except common options, each builder may support different options:
86
86
  - an additional function `i18n` will be available during pug compilation.
87
87
  - `i18n(text)`: translate `text` based on the `i18n` object provided.
88
88
  - `language()`: return current language. ( e.g., `zh-TW` )
89
- - `intlbase(p)`: return a path to given `p`, based on current i18n setup.
89
+ - `intlbase(p, lng)`: return a path to given `p`, based on current i18n ( or specified `lng` arg ) setup.
90
+ - for example, `intlbase('link', 'kr')` may generate `/intl/kr/link`, based on he base dir config.
90
91
  - additionally, a pug filter `i18n` is also available, which can be used like:
91
92
 
92
93
  span:i18n translate this text
package/dist/ext/pug.js CHANGED
@@ -145,21 +145,21 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
145
145
  ret.i18n.language = function(){
146
146
  return this$.i18n.language;
147
147
  };
148
- ret.i18n.intlbase = function(p){
148
+ ret.i18n.intlbase = function(p, lng){
149
149
  p == null && (p = "");
150
- if (this$.i18n.language) {
151
- return path.join(this$.intlbase, this$.i18n.language, p);
152
- } else {
150
+ lng == null && (lng = "");
151
+ if (!(lng = lng || this$.i18n.language)) {
153
152
  return p;
154
153
  }
154
+ return path.join(this$.intlbase, lng, p);
155
155
  };
156
- ret.intlbase = function(p){
156
+ ret.intlbase = function(p, lng){
157
157
  p == null && (p = "");
158
- if (this$.i18n.language) {
159
- return path.join(this$.intlbase, this$.i18n.language, p);
160
- } else {
158
+ lng == null && (lng = "");
159
+ if (!(lng = lng || this$.i18n.language)) {
161
160
  return p;
162
161
  }
162
+ return path.join(this$.intlbase, lng, p);
163
163
  };
164
164
  (ret.filters || (ret.filters = {})).i18n = function(t, o){
165
165
  return this$.i18n.t((t || '').trim());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "zbryikt",
3
3
  "name": "@plotdb/srcbuild",
4
- "version": "0.0.42",
4
+ "version": "0.0.43",
5
5
  "description": "",
6
6
  "main": "./dist/main.js",
7
7
  "files": [