feat: locale system groundwork + various improvements

This commit is contained in:
NGPixel
2023-05-27 04:57:27 +00:00
parent 4d1ab1f193
commit 102c23ec1e
35 changed files with 803 additions and 1952 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ export default {
Query: {
async locales(obj, args, context, info) {
let remoteLocales = await WIKI.cache.get('locales')
let localLocales = await WIKI.db.locales.query().select('code', 'isRTL', 'name', 'nativeName', 'createdAt', 'updatedAt', 'availability')
let localLocales = await WIKI.db.locales.query().select('code', 'isRTL', 'name', 'nativeName', 'createdAt', 'updatedAt', 'completeness')
remoteLocales = remoteLocales || localLocales
return _.map(remoteLocales, rl => {
let isInstalled = _.some(localLocales, ['code', rl.code])
@@ -16,8 +16,8 @@ export default {
}
})
},
translations (obj, args, context, info) {
return WIKI.lang.getByNamespace(args.locale, args.namespace)
localeStrings (obj, args, context, info) {
return WIKI.db.locales.getStrings(args.locale)
}
},
Mutation: {
+4 -7
View File
@@ -4,7 +4,7 @@
extend type Query {
locales: [LocalizationLocale]
translations(locale: String!, namespace: String!): [Translation]
localeStrings(locale: String!): JSON
}
extend type Mutation {
@@ -25,7 +25,7 @@ extend type Mutation {
# -----------------------------------------------
type LocalizationLocale {
availability: Int
completeness: Int
code: String
createdAt: Date
installDate: Date
@@ -33,10 +33,7 @@ type LocalizationLocale {
isRTL: Boolean
name: String
nativeName: String
region: String
script: String
updatedAt: Date
}
type Translation {
key: String
value: String
}
+6 -8
View File
@@ -65,11 +65,10 @@ type Site {
sitemap: Boolean
robots: SiteRobots
features: SiteFeatures
discoverable: Boolean
defaults: SiteDefaults
uploads: SiteUploads
locale: String
localeNamespaces: [String]
localeNamespacing: Boolean
locales: SiteLocales
editors: SiteEditors
theme: SiteTheme
}
@@ -98,11 +97,9 @@ type SiteUploads {
normalizeFilename: Boolean
}
type SiteLocale {
locale: String
autoUpdate: Boolean
namespacing: Boolean
namespaces: [String]
type SiteLocales {
primary: String
active: [String]
}
type SiteEditors {
@@ -184,6 +181,7 @@ input SiteUpdateInput {
sitemap: Boolean
robots: SiteRobotsInput
features: SiteFeaturesInput
discoverable: Boolean
defaults: SiteDefaultsInput
uploads: SiteUploadsInput
editors: SiteEditorsInput