Skip to content

Commit 2cd2c20

Browse files
committed
use own interpolation function
1 parent b1e42e4 commit 2cd2c20

5 files changed

Lines changed: 14 additions & 13 deletions

File tree

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 2.6.2
2+
3+
- use own interpolation function instead of relying on i18next's interpolator
4+
15
### 2.6.1
26

37
- Bump js-yaml from 4.1.0 to 4.1.1 (#64)

lib/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,11 @@ export function getPath (object, path) {
6868
if (!obj) return undefined
6969
return obj[k]
7070
}
71+
72+
const interpolationRegexp = /\{\{(.+?)\}\}/g
73+
export function interpolate (str, data) {
74+
return str.replace(interpolationRegexp, (match, key) => {
75+
const value = data[key.trim()]
76+
return value != null ? value : match
77+
})
78+
}

licence

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2024 i18next
1+
Copyright (c) 2020-present i18next
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"eslint-plugin-require-path-exists": "1.1.9",
4343
"eslint-plugin-standard": "5.0.0",
4444
"expect.js": "0.3.1",
45-
"i18next": "24.0.0",
45+
"i18next": "26.0.3",
4646
"js-yaml": "4.1.1",
4747
"jsonc-parser": "3.3.1",
4848
"json5": "2.2.3",

0 commit comments

Comments
 (0)