mirror of
https://github.com/requarks/wiki.git
synced 2026-08-26 21:27:10 -05:00
feat: locale system groundwork + various improvements
This commit is contained in:
@@ -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 +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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user