@rpcbase/client 0.88.0 → 0.90.0

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/auth/sign_out.js CHANGED
@@ -8,5 +8,6 @@ export const sign_out = () => {
8
8
  localStorage.clear()
9
9
 
10
10
  // TODO: clear DB
11
- console.log("TODO cln")
11
+ // https://stackoverflow.com/a/15861765
12
+ console.log("TODO clear DB")
12
13
  }
package/i18next.js CHANGED
@@ -4,10 +4,14 @@ import {initReactI18next} from "react-i18next"
4
4
  import ChainedBackend from "i18next-chained-backend"
5
5
  import resourcesToBackend from "i18next-resources-to-backend"
6
6
 
7
- export const SUPPORTED_LOCALES = ["en", "fr", "es", "pt", "de"]
7
+ import getLocaleFromCode from "@rpcbase/std/get_locale_from_code"
8
+
9
+ import {RB_DEFAULT_LOCALE, RB_SUPPORTED_LOCALES} from "env"
8
10
 
9
11
  const LOCALE_KEY = "rb.i18n_locale"
10
- const DEFAULT_LOCALE = "en"
12
+
13
+ const DEFAULT_LOCALE = RB_DEFAULT_LOCALE || "en"
14
+ const SUPPORTED_LOCALES = RB_SUPPORTED_LOCALES || ["en"]
11
15
 
12
16
  // https://github.com/i18next/i18next-browser-languageDetector
13
17
 
@@ -25,16 +29,7 @@ export default (backendFn) => {
25
29
  .use(initReactI18next)
26
30
  .init({
27
31
  lng: locale,
28
- fallbackLng: (code) => {
29
- if (code.indexOf("-") > -1) {
30
- const [firstPart] = code.split("-")
31
- if (SUPPORTED_LOCALES.includes(firstPart)) return firstPart
32
- } else if (SUPPORTED_LOCALES.includes(code)) {
33
- return code
34
- }
35
- // no match in our locales, fallback to default
36
- return DEFAULT_LOCALE
37
- },
32
+ fallbackLng: (code) => getLocaleFromCode(code, DEFAULT_LOCALE, SUPPORTED_LOCALES),
38
33
  defaultNS: "common",
39
34
  backend: {
40
35
  backends: [resourcesToBackend(backendFn)],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.88.0",
3
+ "version": "0.90.0",
4
4
  "scripts": {
5
5
  "build-firebase": "webpack -c firebase/webpack.config.js",
6
6
  "build": "yarn build-firebase",