Skip to content

Commit 142da6f

Browse files
committed
Added getLanguage and return path if no tranlsation is found
1 parent d9b7946 commit 142da6f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-multi-lang",
3-
"version": "0.2.1",
3+
"version": "1.0.0",
44
"description": "React Multilanguage Higher-Order Component",
55
"main": "lib/index.js",
66
"files": [

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export function setLanguage (lang: string) {
7272
triggerSubscriptions()
7373
}
7474

75+
export function getLanguage (): string {
76+
return(language)
77+
}
78+
7579
export function t (path: string, args?: {[string]: string}): string {
7680
const translationKeys: string[] = path.split('.')
7781
let translation: string = ''
@@ -97,6 +101,8 @@ export function t (path: string, args?: {[string]: string}): string {
97101
}
98102
)
99103
}
104+
} else {
105+
return path
100106
}
101107

102108
return translation

0 commit comments

Comments
 (0)