Skip to content

Conversation

@cavic19
Copy link

@cavic19 cavic19 commented Sep 11, 2022

Sometimes it is useful to structure a language package object in a nested manner. Such as

//root
{
  hello: "Hi",
  formal: {
    hello: "Hello, sir",
    small_talk: "What a beautiful weather"
  }
}

//zh-hk
{
  hello: "雷吼",
  formal: {
    hello: "你好,先生",
  }
}

Fallback mechanism, however, doesn't work for such a nested structure resulting in an undefined value.

lang.init('zh-hk');
lang.formal.small_talk; //results in undefined

This PR solves this issues by introducing recursive function, that is responsible for the fallback.

@TooBug TooBug merged commit 5c01687 into futuweb:master Sep 14, 2022
@TooBug
Copy link
Contributor

TooBug commented Sep 14, 2022

Released in 0.9.4. Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants