Browse Source

Fix "0" substitutions

master
Vitaliy Filippov 2 months ago
parent
commit
8eb8527f94
  1. 2
      package.json
  2. 8
      runtime.js

2
package.json

@ -1,6 +1,6 @@
{
"name": "babel-plugin-react-translate",
"version": "1.0.2",
"version": "1.0.3",
"description": "Babel-based JS/JSX auto-translator for Russian language",
"main": "index.js",
"scripts": {

8
runtime.js

@ -46,7 +46,13 @@ export function L(s)
if (arguments.length > 1)
{
const arg = arguments;
s = s.replace(/\{(\d+)\}/g, (m, m1) => (arg[parseInt(m1)]||''));
s = s.replace(/\{(\d+)\}/g, (m, m1) =>
{
let r = arg[parseInt(m1)];
if (r == null)
r = '';
return r;
});
s = s.replace(
/\{N:(\d+):((?:[^:\\]+|\\.)*):((?:[^:\\]+|\\.)*):((?:[^:\\]+|\\.)*)\}/g,
(m, m1, m2, m3, m4) => plural(

Loading…
Cancel
Save