From 3239942ff1ce4173276199f5e2c2fa370c3d5034 Mon Sep 17 00:00:00 2001 From: Candy Date: Thu, 4 Aug 2016 17:26:01 -0400 Subject: [PATCH] Update globalization --- example/mobile-models/app.js | 2 +- intl/en/messages.json | 23 +++++++++++++---------- lib/application.js | 2 +- lib/model.js | 11 ++++++----- lib/persisted-model.js | 6 +++--- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/example/mobile-models/app.js b/example/mobile-models/app.js index db52d5f3..68b67e5d 100644 --- a/example/mobile-models/app.js +++ b/example/mobile-models/app.js @@ -48,6 +48,6 @@ function(err, result) { console.log(result.toObject()); result.resetKeys(function(err, result) { - g.log(result.toObject()); + console.log(result.toObject()); }); }); diff --git a/intl/en/messages.json b/intl/en/messages.json index bbb26a73..70fc9dc1 100644 --- a/intl/en/messages.json +++ b/intl/en/messages.json @@ -3,12 +3,11 @@ "7e0fca41d098607e1c9aa353c67e0fa1": "Invalid Access Token", "320c482401afa1207c04343ab162e803": "Invalid principal type: {0}", "c2b5d51f007178170ca3952d59640ca4": "Cannot rectify {0} changes:\n{1}", - "b2aa64e3b5aa234388d0b457f3ba995a": "You must connect the Email Model to a Mail connector", + "5858e63efaa0e4ad86b61c0459ea32fa": "You must connect the {{Email}} Model to a {{Mail}} connector", "0caffe1d763c8cca6a61814abe33b776": "Email is required", "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", "2362ba55796c733e337af169922327a2": "Related objects to include in the response. See the description of return value for more details.", "306999d39387d87b2638199ff0bed8ad": "Reset password for a user with email.", - "39f25db6c2d9cb0c11d9c46ef6bd3402": "username or email is required", "3aae63bb7e8e046641767571c1591441": "login failed as the email has not been verified", "3caaa84fc103d6d5612173ae6d43b245": "Invalid token: {0}", "42e3fa18945255412ebc6561e2c6f1dc": "Confirm a user registration with email verification token.", @@ -18,9 +17,10 @@ "83cfabbe3aa84ce52e0f5ed7c3b2e9b3": "Login a user with username/email and password.", "8608c28f5e6df0008266e3c497836176": "Logout a user with access token.", "860d1a0b8bd340411fb32baa72867989": "The transport does not support HTTP redirects.", + "895b1f941d026870b3cc8e6af087c197": "{{username}} or {{email}} is required", "a50d10fc6e0959b220e085454c40381e": "User not found: {0}", - "a9ce058e495aba6f1aa3e041bfc1035b": "could not find accessToken", "ad24a933c0351aa6fc39c8f1431b0ee4": "realm is required", + "c34fa20eea0091747fcc9eda204b8d37": "could not find {{accessToken}}", "c68a93f0a9524fed4ff64372fc90c55f": "Must provide a valid email", "f58cdc481540cd1f69a4aa4da2e37981": "Invalid password: {0}", "f0bd73df8714cefb925e3b8da2f4c5f6": "result:{0}", @@ -34,8 +34,8 @@ "2d3071e3b18681c80a090dc0efbdb349": "could not find {0} with id {1}", "316e5b82c203cf3de31a449ee07d0650": "Expected boolean, got {0}", "57b87ae0e65f6ab7a2e3e6cbdfca49a4": "Cannot create data source {0}: {1}", - "62e933dca3cbd369087f706db669e881": "{{`app.boot`}} was removed, use the new module loopback-boot instead", "7e287fc885d9fdcf42da3a12f38572c1": "Authorization Required", + "d5552322de5605c58b62f47ad26d2716": "{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead", "1d7833c3ca2f05fdad8fad7537531c40": "\t SUBJECT:{0}", "275f22ab95671f095640ca99194b7635": "\t FROM:{0}", "3d63008ccfb2af1db2142e8cc2716ace": "Warning: No email transport specified for sending email. Setup a transport to send mail messages.", @@ -45,11 +45,13 @@ "ecb06666ef95e5db27a5ac1d6a17923b": "\t TO:{0}", "f0aed00a3d3d0b97d6594e4b70e0c201": "\t TRANSPORT:{0}", "0da38687fed24275c1547e815914a8e3": "Delete a related item by id for {0}.", + "0e4f89f8dde1e88cbfc6c1d88f0f77cb": "Criteria to match model instances", "22fe62fa8d595b72c62208beddaa2a56": "Update a related item by id for {0}.", "528325f3cbf1b0ab9a08447515daac9a": "Update {0} of this model.", "543d19bad5e47ee1e9eb8af688e857b4": "Foreign key for {0}.", "598ff0255ffd1d1b71e8de55dbe2c034": "Check the existence of {0} relation to an item by id.", "5a36cc6ba0cc27c754f6c5ed6015ea3c": "Remove the {0} relation to an item by id.", + "5fa3afb425819ebde958043e598cb664": "could not find a model with {{id}} {0}", "61e5deebaf44d68f4e6a508f30cc31a3": "Relation `{0}` does not exist for model `{1}`", "651f0b3cbba001635152ec3d3d954d0a": "Find a related item by id for {0}.", "7bc7b301ad9c4fc873029d57fb9740fe": "Queries {0} of {1}.", @@ -58,11 +60,12 @@ "855ecd4a64885ba272d782435f72a4d4": "Unknown \"{0}\" id \"{1}\".", "86254879d01a60826a851066987703f2": "Add a related item by id for {0}.", "8ae418c605b6a45f2651be9b1677c180": "Invalid remote method: `{0}`", - "9442a303f4c26de8e29e39430f03d63a": "could not find a model with id {0}", + "9e3cbc1d5a9347cdcf6d1b4a6dbb55b7": "Fetches belongsTo relation {0}.", "c0057a569ff9d3b509bac61a4b2f605d": "Deletes all {0} of this model.", + "cd0412f2f33a4a2a316acc834f3f21a6": "must specify an {{id}} or {{data}}", "d6f43b266533b04d442bdb3955622592": "Creates a new instance in {0} of this model.", "da13d3cdf21330557254670dddd8c5c7": "Counts {0} of {1}.", - "ec296bb6191b3eb43570e250ab4ba919": "must specify an id or data", + "e4434de4bb8f5a3cd1d416e4d80d7e0b": "Unknown \"{0}\" {{id}} \"{1}\".", "f66ae3cf379b2fce28575a3282defe1a": "Deletes {0} of this model.", "03f79fa268fe199de2ce4345515431c1": "No change record found for {0} with id {1}", "0f1c71f74b040bfbe8d384a414e31f03": "Get a set of deltas and conflicts since the given checkpoint.", @@ -73,27 +76,27 @@ "1caa7cc61266e7aef7db7d2f0e27ac3e": "Update the properties of the most recent change record kept for this instance.", "2a7df74fe6e8462e617b79d5fbb536ea": "Get the most recent change record for this instance.", "2a9684b3d5b3b67af74bac74eb1b0843": "Find all instances of the model matched by filter from the data source.", - "2e406dbfed4c5eaeff9d3daaa366c69e": "Find a model instance by id from the data source.", "2e50838caf0c927735eb15d12866bdd7": "Get the changes to a model since a given checkpoint.Provide a filter object to reduce the number of results returned.", "4203ab415ec66a78d3164345439ba76e": "Cannot call {0}.{1}(). The {2} method has not been setup. The {{PersistedModel}} has not been correctly attached to a {{DataSource}}!", "51ea9b6245bb5e672b236d640ca3b048": "An object of Change property name/value pairs", "55ddedd4c501348f82cb89db02ec85c1": "An object of model property name/value pairs", + "5f659bbc15e6e2b249fa33b3879b5f69": "Find a model instance by {{id}} from the data source.", "62e8b0a733417978bab22c8dacf5d7e6": "Cannot apply bulk updates, the connector does not correctly report the number of updated records.", "6329e0ac1de3c250ebb1df5afd5a2a7b": "The number of instances updated", "6bc376432cd9972cf991aad3de371e78": "Missing data for change: {0}", + "79295ac04822d2e9702f0dd1d0240336": "Update instances of the model matched by {{where}} from the data source.", "7f2fde7f0f860ead224b11ba8d75aa1c": "Create an update list from a delta list.", "829160747cbc802e29d8cd45c68e7dba": "Patch attributes for a model instance and persist it into the data source.", + "89b57e764c2267129294b07589dbfdc2": "Delete a model instance by {{id}} from the data source.", "8bab6720ecc58ec6412358c858a53484": "Bulk update failed, the connector has modified unexpected number of records: {0}", "a98b6cc6547706b5c6bffde0ed5fd55c": "Find first instance of the model matched by filter from the data source.", "aada86412c03def85d98b75e4d786edc": "Patch an existing model instance or insert a new one into the data source.", "c46d4aba1f14809c16730faa46933495": "Filter defining fields and include", "c65600640f206f585d300b4bcb699d95": "Create a checkpoint.", - "d32cbcec1c7022d9a975699865ff6036": "Delete a model instance by id from the data source.", "dcb6261868ff0a7b928aa215b07d068c": "Create a change stream.", "e43e320a435ec1fa07648c1da0d558a7": "Check whether a model instance exists in the data source.", "e92aa25b6b864e3454b65a7c422bd114": "Bulk update failed, the connector has deleted unexpected number of records: {0}", "ea63d226b6968e328bdf6876010786b5": "Cannot apply bulk updates, the connector does not correctly report the number of deleted records.", - "f04c62976db4b2b6c8bf907087b53996": "Update instances of the model matched by where from the data source.", "f1d4ac54357cc0932f385d56814ba7e4": "Conflict", "f37d94653793e33f4203e45b4a1cf106": "Count instances of the model matched by where from the data source.", "0e21aad369dd09e1965c11949303cefd": "Remoting metadata for {0}.{1} {{\"isStatic\"}} does not match new method name-based style.", @@ -108,5 +111,5 @@ "97795efe0c3eb7f35ce8cf8cfe70682b": "The configuration of `{0}` is missing {{`dataSource`}} property.\nUse `null` or `false` to mark models not attached to any data source.", "c61a5a02ba3801a892308f70f5d55a14": "Remoting metadata {{\"isStatic\"}} is deprecated. Please specify {{\"prototype.name\"}} in method name instead for {{isStatic=false}}.", "dc568bee32deb0f6eaf63e73b20e8ceb": "Ignoring non-object \"methods\" setting of \"{0}\".", - "cb6b65cca90372e428100fd21f8b2259": "Unknown middleware phase {0}" + "3aecb24fa8bdd3f79d168761ca8a6729": "Unknown {{middleware}} phase {0}" } diff --git a/lib/application.js b/lib/application.js index a1850708..482fa6a5 100644 --- a/lib/application.js +++ b/lib/application.js @@ -409,7 +409,7 @@ app.enableAuth = function(options) { app.boot = function(options) { throw new Error( - g.f('{{`app.boot`}} was removed, use the new module loopback-boot instead')); + g.f('{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead')); }; function dataSourcesFromConfig(name, config, connectorRegistry, registry) { diff --git a/lib/model.js b/lib/model.js index 530c81e5..7652875c 100644 --- a/lib/model.js +++ b/lib/model.js @@ -170,14 +170,14 @@ module.exports = function(registry) { } else if (model) { fn(null, model); } else { - err = new Error(g.f('could not find a model with id %s', id)); + err = new Error(g.f('could not find a model with {{id}} %s', id)); err.statusCode = 404; err.code = 'MODEL_NOT_FOUND'; fn(err); } }); } else { - fn(new Error(g.f('must specify an id or data'))); + fn(new Error(g.f('must specify an {{id}} or {{data}}'))); } }; @@ -454,7 +454,7 @@ module.exports = function(registry) { http: { verb: 'get', path: '/' + pathName }, accepts: { arg: 'refresh', type: 'boolean', http: { source: 'query' }}, accessType: 'READ', - description: 'Fetches belongsTo relation ' + relationName + '.', + description: g.f('Fetches belongsTo relation %s.', relationName), returns: { arg: relationName, type: modelName, root: true }, }, fn); }; @@ -611,7 +611,7 @@ module.exports = function(registry) { if (ctx.result === false) { var modelName = ctx.method.sharedClass.name; var id = ctx.getArgByName('id'); - var msg = g.f('Unknown "%s" id "%s".', modelName, id); + var msg = g.f('Unknown "%s" {{id}} "%s".', modelName, id); var error = new Error(msg); error.statusCode = error.status = 404; error.code = 'MODEL_NOT_FOUND'; @@ -669,7 +669,8 @@ module.exports = function(registry) { define('__count__' + scopeName, { isStatic: isStatic, http: { verb: 'get', path: '/' + pathName + '/count' }, - accepts: { arg: 'where', type: 'object', description: 'Criteria to match model instances' }, + accepts: { arg: 'where', type: 'object', + description: g.f('Criteria to match model instances') }, description: g.f('Counts %s of %s.', scopeName, this.modelName), accessType: 'READ', returns: { arg: 'count', type: 'number' }, diff --git a/lib/persisted-model.js b/lib/persisted-model.js index bcc6c4be..1acbfcbe 100644 --- a/lib/persisted-model.js +++ b/lib/persisted-model.js @@ -84,7 +84,7 @@ module.exports = function(registry) { var modelName = ctx.method.sharedClass.name; var id = ctx.getArgByName('id'); - var msg = g.f('Unknown "%s" id "%s".', modelName, id); + var msg = g.f('Unknown "%s" {{id}} "%s".', modelName, id); var error = new Error(msg); error.statusCode = error.status = 404; error.code = 'MODEL_NOT_FOUND'; @@ -686,7 +686,7 @@ module.exports = function(registry) { }); setRemoting(PersistedModel, 'findById', { - description: g.f('Find a model instance by id from the data source.'), + description: g.f('Find a model instance by {{id}} from the data source.'), accessType: 'READ', accepts: [ { arg: 'id', type: 'any', description: 'Model id', required: true, @@ -773,7 +773,7 @@ module.exports = function(registry) { setRemoting(PersistedModel, 'deleteById', { aliases: ['destroyById', 'removeById'], - description: g.f('Delete a model instance by id from the data source.'), + description: g.f('Delete a model instance by {{id}} from the data source.'), accessType: 'WRITE', accepts: { arg: 'id', type: 'any', description: 'Model id', required: true, http: { source: 'path' }},