Slightly improved performance of RuntimeFunctionGenerator
function.
Fixed that in some cases eval was still used eventhough disabled with setNoEval()
.
Add method setNoEval()
to forbid using new Function
to speed up formatting, but it does not require CSP script unsafe-eval.
Make it compatible with noPropertyAccessFromIndexSignature.
Fix bug which forced whole Bobril to be included.
Make it compatible with noUncheckedIndexedAccess.
Fixed jsonp return type to be compatible with TS 4.1.x
Needs TypeScript 3.7+, directly depends on Bobril. Support formatting of elements of virtual dom.
f("Hello {1}{world}{/1}", { 1: (p: b.IBobrilChildren) => <b>{p}</b>, world: "World" });
f("Simple {1/}", { 1: () => <App /> });
// Next thing also needs support in bobril-build
<T hint="translation hint" param1={42}>
Answer is <strong>{t("{param1}")}</strong>!
</T>;
Fix regression with number/boolean parameters.
DelayedMessages and SerializedMessages are now more useful. They are automatically expanded in any message parameters during formatting. Function f
was expanded to support formatting of DelayedMessages and SerializedMessages. serializeMessage
now does recursive serialization including parameters.
console.log(f(dt("Blabla {aparam}", { aparam: dt("hello") })));
let sendToServer = serializeMessage(dt(""));
console.log(f(receivedFromServerFromDifferentVersion));
formatSerializedMessage
and formatDelayedMessage
are obsolete and should be replaced by f
.
Note: Needs to be used with Bobril 8.16.0 which polyfills String.endsWith
Made compatible with TypeScript 3.1.1
New feature of DelayedMessages and SerializedMessages. Allows transferring messages between different applications. Allows to run without Bobril and customize running scripts from url to be able to run on without browser.
New feature relativepast how to format relative time. It is same as relative just it never display future time.
Compare locale in case insensitive way.
Global moment has set current locale. So you are free to use it, but even better is just use getMoment.
Simplified typings and Moment import.
Remove empty files from tsconfig.json
Remove nonsense JSX from tsconfig.json
Improved upon previous fix by using and exporting useful escapeRegExp function.
Fixes bug with unformating number in locales with . as thousands separator
Reintroduce number format "0 b", but with nonbreakable space in output which makes more sence.
Added feature to turn on/off preview of translated texts. When turned on, texts that are translated will be encapsulated by user function. To enable it run this in console:
b.spyTr(function(t){return "["+t+"]"});
To disable it run this in console:
b.spyTr(null);
To check if enabled run this in console:
b.spyTr()!==undefined
Breaking change needs bobril-build 0.57+.
Removed dependency on numeral, make code shorter, but also faster. It has slightly less features, so if you missing some please add failing test.
Compilation errors with TS 2.1.4. setLocale
returns Promise<void>
instead of Promise<any>
Fixed tests. Now testable by Bobril-build.
Fixed problem with en-gb date format treated as en only. The formated date for en-gb locale should now be DD/MM/YYYY
Additional improvements for TS 2.0
Compilable by TS 2.0 with most strict settings.
Requires Bobril 4.44.0 or higher, but does not depend on it in package.json. Bobril needs to be required sooner than bobril-g11n. When setLocale fails it will revoke returned promise. Additionally it will try to revert to default locale before.
Check plural and selectordinal selectors to be only in allowed list.
Added 2 additional parameters to getMoment function.
Missing translation file just logs to console instead of crashing.