Default value
See original GitHub issueHello. Please, look at example code:
var locale = {
en1:{
msg1:"Test1",
msg2:"Test2"
},
en2:{
msg1:"Test1",
}
}
Now, If I try to use $t(‘msg1’) when lang is set to “en2” I’ll see on screen “Test1”. But if I try to use $t(‘msg2’) I’ll see “msg2”. How can I set default lang, or what should I do, If I want to return default lang value, when the value is absent in current lang?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
value expressions - produce the default value for any type
A default value expression produces the default value of a type. There are two kinds of default value expressions: the default operator call ......
Read more >Documentation: 15: 5.2. Default Values - PostgreSQL
In a table definition, default values are listed after the column data type. For example: CREATE TABLE products ( product_no integer, name text,...
Read more >SQL DEFAULT Constraint - W3Schools
The DEFAULT constraint is used to set a default value for a column. The default value will be added to all new records,...
Read more >Specify default column values | BigQuery - Google Cloud
This page describes how to set a default value for a column in a BigQuery table. ... You can set the default value...
Read more >Default parameters - JavaScript - MDN Web Docs
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @VegardSkui @guillaumevincent & @LuckyBlade.
I don’t know if you already solved this, but there’s a fallbackLang property as part of this package that can be set to the Vue.config object to fallback to a specific language.
So whenever bootstrapping your application besides setting the
Vue.config.lang
, also setVue.config.fallbackLang
.e.g.:
Vue.config.fallbackLang = 'en1'
That would solve your needs.
maybe the api could be more friendly like :
it’s more declarative, can be extracted automatically, and always display a value, even if an error occurred.
Love the api in the v2 of Intl in FormatJS by yahoo
https://github.com/yahoo/react-intl/issues/162