From 89ff760b6d0d45f702ab674cf233eaa20e09766f Mon Sep 17 00:00:00 2001 From: Diana Lau Date: Mon, 20 Aug 2018 11:10:02 -0400 Subject: [PATCH] Make desc when export-api-def translatable --- intl/en/messages.json | 20 ++++++++++++++++++-- lib/model.js | 44 +++++++++++++++++++++---------------------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/intl/en/messages.json b/intl/en/messages.json index e17d564a..1338fd42 100644 --- a/intl/en/messages.json +++ b/intl/en/messages.json @@ -3,11 +3,13 @@ "04bd8af876f001ceaf443aad6a9002f9": "Authentication requires model {0} to be defined.", "095afbf2f1f0e5be678f5dac5c54e717": "Access Denied", "0caffe1d763c8cca6a61814abe33b776": "Email is required", + "0da38687fed24275c1547e815914a8e3": "Delete a related item by id for {0}.", "0e21aad369dd09e1965c11949303cefd": "Remoting metadata for {0}.{1} {{\"isStatic\"}} does not match new method name-based style.", "10e01c895dc0b2fecc385f9f462f1ca6": "a list of colors is available at {{http://localhost:3000/colors}}", "1b2a6076dccbe91a56f1672eb3b8598c": "The response body contains properties of the {{AccessToken}} created on login.\nDepending on the value of `include` parameter, the body may contain additional properties:\n\n - `user` - `U+007BUserU+007D` - Data of the currently logged in user. {{(`include=user`)}}\n\n", "1d7833c3ca2f05fdad8fad7537531c40": "\t SUBJECT:{0}", "1e85f822b547a75d7d385048030e4ecb": "Created: {0}", + "22fe62fa8d595b72c62208beddaa2a56": "Update a related item by id for {0}.", "275f22ab95671f095640ca99194b7635": "\t FROM:{0}", "2860bccdf9ef1e350c1a38932ed12173": "{0} was removed in version 3.0. See {1} for more details.", "2d3071e3b18681c80a090dc0efbdb349": "could not find {0} with id {1}", @@ -16,6 +18,7 @@ "3438fab56cc7ab92dfd88f0497e523e0": "The relations property of `{0}` configuration must be an object", "3591f1d3e115b46f9f195df5ca548a6a": "Model not found: model `{0}` is extending an unknown model `{1}`.", "35e5252c62d80f8c54a5290d30f4c7d0": "Please verify your email by opening this link in a web browser:\n\t{0}", + "37bcd4b50dfae98734772e39ffb1ea3d": "The password entered was too long. Max length is {0} (entered {1})", "3aae63bb7e8e046641767571c1591441": "login failed as the email has not been verified", "3aecb24fa8bdd3f79d168761ca8a6729": "Unknown {{middleware}} phase {0}", "3ca45aa6f705c46a4c598a900716f086": "{0} is using model setting {1} which is no longer available.", @@ -27,41 +30,54 @@ "44a6c8b1ded4ed653d19ddeaaf89a606": "Email not found", "4a4f04a4e480fc5d4ee73b84d9a4b904": "Sending Mail:", "4b494de07f524703ac0879addbd64b13": "Email has not been verified", + "528325f3cbf1b0ab9a08447515daac9a": "Update {0} of this model.", + "543d19bad5e47ee1e9eb8af688e857b4": "Foreign key for {0}.", "57b87ae0e65f6ab7a2e3e6cbdfca49a4": "Cannot create data source {0}: {1}", "5858e63efaa0e4ad86b61c0459ea32fa": "You must connect the {{Email}} Model to a {{Mail}} connector", + "598ff0255ffd1d1b71e8de55dbe2c034": "Check the existence of {0} relation to an item by id.", + "5a36cc6ba0cc27c754f6c5ed6015ea3c": "Remove the {0} relation to an item by id.", "5e81ad3847a290dc650b47618b9cbc7e": "login failed", "5fa3afb425819ebde958043e598cb664": "could not find a model with {{id}} {0}", "61e5deebaf44d68f4e6a508f30cc31a3": "Relation `{0}` does not exist for model `{1}`", "62e8b0a733417978bab22c8dacf5d7e6": "Cannot apply bulk updates, the connector does not correctly report the number of updated records.", "63a091ced88001ab6acb58f61ec041c5": "\t TEXT:{0}", + "651f0b3cbba001635152ec3d3d954d0a": "Find a related item by id for {0}.", "6bc376432cd9972cf991aad3de371e78": "Missing data for change: {0}", "705c2d456a3e204c4af56e671ec3225c": "Could not find {{accessToken}}", "734a7bebb65e10899935126ba63dd51f": "The options property of `{0}` configuration must be an object", "779467f467862836e19f494a37d6ab77": "The acls property of `{0}` configuration must be an array of objects", + "7bc7b301ad9c4fc873029d57fb9740fe": "Queries {0} of {1}.", + "7c837b88fd0e509bd3fc722d7ddf0711": "Foreign key for {0}", "7d5e7ed0efaedf3f55f380caae0df8b8": "My first mobile application", "7e0fca41d098607e1c9aa353c67e0fa1": "Invalid Access Token", "7e287fc885d9fdcf42da3a12f38572c1": "Authorization Required", "7ea04ea91aac3cb7ce0ddd96b7ff1fa4": "{{accessToken}} is required to logout", "80a32e80cbed65eba2103201a7c94710": "Model not found: {0}", + "830cb6c862f8f364e9064cea0026f701": "Fetches hasOne relation {0}.", "83cbdc2560ba9f09155ccfc63e08f1a1": "Property `{0}` cannot be reconfigured for `{1}`", + "855eb8db89b4921c42072832d33d2dc2": "Invalid password.", "855ecd4a64885ba272d782435f72a4d4": "Unknown \"{0}\" id \"{1}\".", "860d1a0b8bd340411fb32baa72867989": "The transport does not support HTTP redirects.", + "86254879d01a60826a851066987703f2": "Add a related item by id for {0}.", "895b1f941d026870b3cc8e6af087c197": "{{username}} or {{email}} is required", - "8a17c5ef611e2e7535792316e66b8fca": "Password too long: {0}", "8ae418c605b6a45f2651be9b1677c180": "Invalid remote method: `{0}`", "8bab6720ecc58ec6412358c858a53484": "Bulk update failed, the connector has modified unexpected number of records: {0}", "8ecab7f534de38360bd1b1c88e880123": "Child models of `{0}` will not inherit newly defined remote methods {1}.", "93ba9a1d03da3b7696332d3f155c5bb7": "\t HTML:{0}", "97795efe0c3eb7f35ce8cf8cfe70682b": "The configuration of `{0}` is missing {{`dataSource`}} property.\nUse `null` or `false` to mark models not attached to any data source.", + "9e3cbc1d5a9347cdcf6d1b4a6dbb55b7": "Fetches belongsTo relation {0}.", "a50d10fc6e0959b220e085454c40381e": "User not found: {0}", "b6f740aeb6f2eb9bee9cb049dbfe6a28": "Unknown \"{0}\" {{key}} \"{1}\".", "ba96498b10c179f9cd75f75c8def4f70": "{{realm}} is required", + "c0057a569ff9d3b509bac61a4b2f605d": "Deletes all {0} of this model.", "c2b5d51f007178170ca3952d59640ca4": "Cannot rectify {0} changes:\n{1}", "c4ee6d177c974532c3552d2f98eb72ea": "{0} middleware was removed in version 3.0. See {1} for more details.", "c61a5a02ba3801a892308f70f5d55a14": "Remoting metadata {{\"isStatic\"}} is deprecated. Please specify {{\"prototype.name\"}} in method name instead for {{isStatic=false}}.", "c68a93f0a9524fed4ff64372fc90c55f": "Must provide a valid email", "cd0412f2f33a4a2a316acc834f3f21a6": "must specify an {{id}} or {{data}}", "d5552322de5605c58b62f47ad26d2716": "{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead", + "d6f43b266533b04d442bdb3955622592": "Creates a new instance in {0} of this model.", + "da13d3cdf21330557254670dddd8c5c7": "Counts {0} of {1}.", "dc568bee32deb0f6eaf63e73b20e8ceb": "Ignoring non-object \"methods\" setting of \"{0}\".", "e4434de4bb8f5a3cd1d416e4d80d7e0b": "Unknown \"{0}\" {{id}} \"{1}\".", "e92aa25b6b864e3454b65a7c422bd114": "Bulk update failed, the connector has deleted unexpected number of records: {0}", @@ -71,6 +87,6 @@ "f0aed00a3d3d0b97d6594e4b70e0c201": "\t TRANSPORT:{0}", "f0bd73df8714cefb925e3b8da2f4c5f6": "result:{0}", "f1d4ac54357cc0932f385d56814ba7e4": "Conflict", - "f58cdc481540cd1f69a4aa4da2e37981": "Invalid password: {0}", + "f66ae3cf379b2fce28575a3282defe1a": "Deletes {0} of this model.", "f8e26bcca62a47f579562f1cd2c785ff": "Please rework your app to use the offical solution for injecting \"options\" argument from request context,\nsee {0}" } diff --git a/lib/model.js b/lib/model.js index eb955619..5d217931 100644 --- a/lib/model.js +++ b/lib/model.js @@ -545,7 +545,7 @@ module.exports = function(registry) { {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], accessType: 'READ', - description: format('Fetches belongsTo relation %s.', relationName), + description: format(g.f('Fetches belongsTo relation %s.', relationName)), returns: {arg: relationName, type: modelName, root: true}, }, fn); }; @@ -572,7 +572,7 @@ module.exports = function(registry) { {arg: 'refresh', type: 'boolean', http: {source: 'query'}}, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Fetches hasOne relation %s.', relationName), + description: g.f('Fetches hasOne relation %s.', relationName), accessType: 'READ', returns: {arg: relationName, type: relation.modelTo.modelName, root: true}, rest: {after: convertNullToNotFoundError.bind(null, toModelName)}, @@ -588,7 +588,7 @@ module.exports = function(registry) { }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Creates a new instance in %s of this model.', relationName), + description: g.f('Creates a new instance in %s of this model.', relationName), accessType: 'WRITE', returns: {arg: 'data', type: toModelName, root: true}, }); @@ -603,7 +603,7 @@ module.exports = function(registry) { }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Update %s of this model.', relationName), + description: g.f('Update %s of this model.', relationName), accessType: 'WRITE', returns: {arg: 'data', type: toModelName, root: true}, }); @@ -614,7 +614,7 @@ module.exports = function(registry) { accepts: [ {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Deletes %s of this model.', relationName), + description: g.f('Deletes %s of this model.', relationName), accessType: 'WRITE', }); }; @@ -630,13 +630,13 @@ module.exports = function(registry) { accepts: [ { arg: 'fk', type: 'any', - description: format('Foreign key for %s', relationName), + description: g.f('Foreign key for %s', relationName), required: true, http: {source: 'path'}, }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Find a related item by id for %s.', relationName), + description: g.f('Find a related item by id for %s.', relationName), accessType: 'READ', returns: {arg: 'result', type: toModelName, root: true}, rest: {after: convertNullToNotFoundError.bind(null, toModelName)}, @@ -649,13 +649,13 @@ module.exports = function(registry) { accepts: [ { arg: 'fk', type: 'any', - description: format('Foreign key for %s', relationName), + description: g.f('Foreign key for %s', relationName), required: true, http: {source: 'path'}, }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Delete a related item by id for %s.', relationName), + description: g.f('Delete a related item by id for %s.', relationName), accessType: 'WRITE', returns: [], }, destroyByIdFunc); @@ -666,13 +666,13 @@ module.exports = function(registry) { http: {verb: 'put', path: '/' + pathName + '/:fk'}, accepts: [ {arg: 'fk', type: 'any', - description: format('Foreign key for %s', relationName), + description: g.f('Foreign key for %s', relationName), required: true, http: {source: 'path'}}, {arg: 'data', type: 'object', model: toModelName, http: {source: 'body'}}, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Update a related item by id for %s.', relationName), + description: g.f('Update a related item by id for %s.', relationName), accessType: 'WRITE', returns: {arg: 'result', type: toModelName, root: true}, }, updateByIdFunc); @@ -694,13 +694,13 @@ module.exports = function(registry) { isStatic: false, http: {verb: 'put', path: '/' + pathName + '/rel/:fk'}, accepts: [{arg: 'fk', type: 'any', - description: format('Foreign key for %s', relationName), + description: g.f('Foreign key for %s', relationName), required: true, http: {source: 'path'}}, ].concat(accepts).concat([ {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ]), - description: format('Add a related item by id for %s.', relationName), + description: g.f('Add a related item by id for %s.', relationName), accessType: 'WRITE', returns: {arg: relationName, type: modelThrough.modelName, root: true}, }, addFunc); @@ -712,13 +712,13 @@ module.exports = function(registry) { accepts: [ { arg: 'fk', type: 'any', - description: format('Foreign key for %s', relationName), + description: g.f('Foreign key for %s', relationName), required: true, http: {source: 'path'}, }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Remove the %s relation to an item by id.', relationName), + description: g.f('Remove the %s relation to an item by id.', relationName), accessType: 'WRITE', returns: [], }, removeFunc); @@ -732,13 +732,13 @@ module.exports = function(registry) { accepts: [ { arg: 'fk', type: 'any', - description: format('Foreign key for %s', relationName), + description: g.f('Foreign key for %s', relationName), required: true, http: {source: 'path'}, }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Check the existence of %s relation to an item by id.', relationName), + description: g.f('Check the existence of %s relation to an item by id.', relationName), accessType: 'READ', returns: {arg: 'exists', type: 'boolean', root: true}, rest: { @@ -794,7 +794,7 @@ module.exports = function(registry) { {arg: 'filter', type: 'object'}, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Queries %s of %s.', scopeName, this.modelName), + description: g.f('Queries %s of %s.', scopeName, this.modelName), accessType: 'READ', returns: {arg: scopeName, type: [toModelName], root: true}, }); @@ -813,7 +813,7 @@ module.exports = function(registry) { }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Creates a new instance in %s of this model.', scopeName), + description: g.f('Creates a new instance in %s of this model.', scopeName), accessType: 'WRITE', returns: {arg: 'data', type: toModelName, root: true}, }); @@ -831,7 +831,7 @@ module.exports = function(registry) { }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Deletes all %s of this model.', scopeName), + description: g.f('Deletes all %s of this model.', scopeName), accessType: 'WRITE', }); @@ -845,7 +845,7 @@ module.exports = function(registry) { }, {arg: 'options', type: 'object', http: 'optionsFromRequest'}, ], - description: format('Counts %s of %s.', scopeName, this.modelName), + description: g.f('Counts %s of %s.', scopeName, this.modelName), accessType: 'READ', returns: {arg: 'count', type: 'number'}, }); @@ -895,7 +895,7 @@ module.exports = function(registry) { acceptArgs = [ { arg: paramName, type: 'any', http: {source: 'path'}, - description: format('Foreign key for %s.', relation.name), + description: g.f('Foreign key for %s.', relation.name), required: true, }, ];