We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9d87b35 commit ae552a9Copy full SHA for ae552a9
packages/@vue/cli-ui/src/graphql-api/connectors/locales.js
@@ -1,6 +1,7 @@
1
const path = require('path')
2
const fs = require('fs')
3
const globby = require('globby')
4
+const deepmerge = require('deepmerge')
5
// Connectors
6
const cwd = require('./cwd')
7
// Subs
@@ -17,9 +18,13 @@ function list (context) {
17
18
return locales
19
}
20
-function add ({ lang, strings }, context) {
21
- const locale = { lang, strings }
22
- locales.push(locale)
+function add (locale, context) {
+ const existing = locales.find(l => l.lang === locale.lang)
23
+ if (existing) {
24
+ existing.strings = deepmerge(existing.strings, locale.strings)
25
+ } else {
26
+ locales.push(locale)
27
+ }
28
context.pubsub.publish(channels.LOCALE_ADDED, {
29
localeAdded: locale
30
})
0 commit comments