diff options
author | Corey Hulen <corey@hulen.com> | 2016-01-25 09:07:35 -0500 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-01-25 09:07:35 -0500 |
commit | 93a4e85c2d183a48f84a269c38ad4b91e9c31c14 (patch) | |
tree | 9f7cf34b9c70e76524642cf20a3b6ad3c6f3c753 | |
parent | 2a32bf20045a563c3656d89c9e70ab6d3c4505f0 (diff) | |
parent | f33cff21cf41ed060783e1eaad6c1c4838216ed2 (diff) | |
download | chat-93a4e85c2d183a48f84a269c38ad4b91e9c31c14.tar.gz chat-93a4e85c2d183a48f84a269c38ad4b91e9c31c14.tar.bz2 chat-93a4e85c2d183a48f84a269c38ad4b91e9c31c14.zip |
Merge pull request #1974 from ZBoxApp/PLT-7-models
PLT-7: Refactoring models to use translations (chunk 6)
-rw-r--r-- | i18n/en.json | 480 | ||||
-rw-r--r-- | i18n/es.json | 480 | ||||
-rw-r--r-- | model/access.go | 8 | ||||
-rw-r--r-- | model/authorize.go | 16 | ||||
-rw-r--r-- | model/channel.go | 20 | ||||
-rw-r--r-- | model/channel_member.go | 12 | ||||
-rw-r--r-- | model/client.go | 14 | ||||
-rw-r--r-- | model/config.go | 44 | ||||
-rw-r--r-- | model/file_info.go | 2 | ||||
-rw-r--r-- | model/incoming_webhook.go | 12 | ||||
-rw-r--r-- | model/oauth.go | 18 | ||||
-rw-r--r-- | model/outgoing_webhook.go | 20 | ||||
-rw-r--r-- | model/post.go | 28 | ||||
-rw-r--r-- | model/preference.go | 8 | ||||
-rw-r--r-- | model/team.go | 24 | ||||
-rw-r--r-- | model/user.go | 28 | ||||
-rw-r--r-- | model/utils.go | 2 |
17 files changed, 1089 insertions, 127 deletions
diff --git a/i18n/en.json b/i18n/en.json index 3d92042bb..6a7a858e7 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1676,6 +1676,486 @@ "translation": "Current version is %v (%v/%v/%v)" }, { + "id": "model.access.is_valid.access_token.app_error", + "translation": "Invalid access token" + }, + { + "id": "model.access.is_valid.auth_code.app_error", + "translation": "Invalid auth code" + }, + { + "id": "model.access.is_valid.redirect_uri.app_error", + "translation": "Invalid redirect uri" + }, + { + "id": "model.access.is_valid.refresh_token.app_error", + "translation": "Invalid refresh token" + }, + { + "id": "model.authorize.is_valid.auth_code.app_error", + "translation": "Invalid authorization code" + }, + { + "id": "model.authorize.is_valid.client_id.app_error", + "translation": "Invalid client id" + }, + { + "id": "model.authorize.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.authorize.is_valid.expires.app_error", + "translation": "Expires in must be set" + }, + { + "id": "model.authorize.is_valid.redirect_uri.app_error", + "translation": "Invalid redirect uri" + }, + { + "id": "model.authorize.is_valid.scope.app_error", + "translation": "Invalid scope" + }, + { + "id": "model.authorize.is_valid.state.app_error", + "translation": "Invalid state" + }, + { + "id": "model.authorize.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.channel.is_valid.2_or_more.app_error", + "translation": "Name must be 2 or more lowercase alphanumeric characters" + }, + { + "id": "model.channel.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.channel.is_valid.creator_id.app_error", + "translation": "Invalid creator id" + }, + { + "id": "model.channel.is_valid.display_name.app_error", + "translation": "Invalid display name" + }, + { + "id": "model.channel.is_valid.header.app_error", + "translation": "Invalid header" + }, + { + "id": "model.channel.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.channel.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.channel.is_valid.purpose.app_error", + "translation": "Invalid purpose" + }, + { + "id": "model.channel.is_valid.type.app_error", + "translation": "Invalid type" + }, + { + "id": "model.channel.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.channel_member.is_valid.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.channel_member.is_valid.notify_level.app_error", + "translation": "Invalid notify level" + }, + { + "id": "model.channel_member.is_valid.role.app_error", + "translation": "Invalid role" + }, + { + "id": "model.channel_member.is_valid.unread_level.app_error", + "translation": "Invalid mark unread level" + }, + { + "id": "model.channel_member.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.client.connecting.app_error", + "translation": "We encountered an error while connecting to the server" + }, + { + "id": "model.client.login.app_error", + "translation": "Authentication tokens didn't match" + }, + { + "id": "model.config.is_valid.email_reset_salt.app_error", + "translation": "Invalid password reset salt for email settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.email_salt.app_error", + "translation": "Invalid invite salt for email settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.email_security.app_error", + "translation": "Invalid connection security for email settings. Must be '', 'TLS', or 'STARTTLS'" + }, + { + "id": "model.config.is_valid.encrypt_sql.app_error", + "translation": "Invalid at rest encrypt key for SQL settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.file_driver.app_error", + "translation": "Invalid driver name for file settings. Must be 'local' or 'amazons3'" + }, + { + "id": "model.config.is_valid.file_preview_height.app_error", + "translation": "Invalid preview height for file settings. Must be a zero or positive number." + }, + { + "id": "model.config.is_valid.file_preview_width.app_error", + "translation": "Invalid preview width for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_profile_height.app_error", + "translation": "Invalid profile height for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_profile_width.app_error", + "translation": "Invalid profile width for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_salt.app_error", + "translation": "Invalid public link salt for file settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.file_thumb_height.app_error", + "translation": "Invalid thumbnail height for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_thumb_width.app_error", + "translation": "Invalid thumbnail width for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.listen_address.app_error", + "translation": "Invalid listen address for service settings Must be set." + }, + { + "id": "model.config.is_valid.login_attempts.app_error", + "translation": "Invalid maximum login attempts for service settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.max_users.app_error", + "translation": "Invalid maximum users per team for team settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.rate_mem.app_error", + "translation": "Invalid memory store size for rate limit settings. Must be a positive number" + }, + { + "id": "model.config.is_valid.rate_sec.app_error", + "translation": "Invalid per sec for rate limit settings. Must be a positive number" + }, + { + "id": "model.config.is_valid.sql_data_src.app_error", + "translation": "Invalid data source for SQL settings. Must be set." + }, + { + "id": "model.config.is_valid.sql_driver.app_error", + "translation": "Invalid driver name for SQL settings. Must be 'mysql' or 'postgres'" + }, + { + "id": "model.config.is_valid.sql_idle.app_error", + "translation": "Invalid maximum idle connection for SQL settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.sql_max_conn.app_error", + "translation": "Invalid maximum open connection for SQL settings. Must be a positive number." + }, + { + "id": "model.file_info.get.gif.app_error", + "translation": "Could not decode gif." + }, + { + "id": "model.incoming_hook.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.incoming_hook.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.incoming_hook.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.incoming_hook.team_id.app_error", + "translation": "Invalid team id" + }, + { + "id": "model.incoming_hook.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.incoming_hook.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.oauth.is_valid.app_id.app_error", + "translation": "Invalid app id" + }, + { + "id": "model.oauth.is_valid.callback.app_error", + "translation": "Invalid callback urls" + }, + { + "id": "model.oauth.is_valid.client_secret.app_error", + "translation": "Invalid client secret" + }, + { + "id": "model.oauth.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.oauth.is_valid.creator_id.app_error", + "translation": "Invalid creator id" + }, + { + "id": "model.oauth.is_valid.description.app_error", + "translation": "Invalid description" + }, + { + "id": "model.oauth.is_valid.homepage.app_error", + "translation": "Invalid homepage" + }, + { + "id": "model.oauth.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.oauth.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.outgoing_hook.is_valid.callback.app_error", + "translation": "Invalid callback urls" + }, + { + "id": "model.outgoing_hook.is_valid.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.outgoing_hook.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.outgoing_hook.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.outgoing_hook.is_valid.team_id.app_error", + "translation": "Invalid team id" + }, + { + "id": "model.outgoing_hook.is_valid.token.app_error", + "translation": "Invalid token" + }, + { + "id": "model.outgoing_hook.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.outgoing_hook.is_valid.url.app_error", + "translation": "Invalid callback URLs. Each must be a valid URL and start with http:// or https://" + }, + { + "id": "model.outgoing_hook.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.outgoing_hook.is_valid.words.app_error", + "translation": "Invalid trigger words" + }, + { + "id": "model.post.is_valid.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.post.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.post.is_valid.filenames.app_error", + "translation": "Invalid filenames" + }, + { + "id": "model.post.is_valid.hashtags.app_error", + "translation": "Invalid hashtags" + }, + { + "id": "model.post.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.post.is_valid.msg.app_error", + "translation": "Invalid message" + }, + { + "id": "model.post.is_valid.original_id.app_error", + "translation": "Invalid original id" + }, + { + "id": "model.post.is_valid.parent_id.app_error", + "translation": "Invalid parent id" + }, + { + "id": "model.post.is_valid.props.app_error", + "translation": "Invalid props" + }, + { + "id": "model.post.is_valid.root_id.app_error", + "translation": "Invalid root id" + }, + { + "id": "model.post.is_valid.root_parent.app_error", + "translation": "Invalid root id must be set if parent id set" + }, + { + "id": "model.post.is_valid.type.app_error", + "translation": "Invalid type" + }, + { + "id": "model.post.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.post.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.preference.is_valid.category.app_error", + "translation": "Invalid category" + }, + { + "id": "model.preference.is_valid.id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.preference.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.preference.is_valid.value.app_error", + "translation": "Value is too long" + }, + { + "id": "model.team.is_valid.characters.app_error", + "translation": "Name must be 4 or more lowercase alphanumeric characters" + }, + { + "id": "model.team.is_valid.company.app_error", + "translation": "Invalid company name" + }, + { + "id": "model.team.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.team.is_valid.domains.app_error", + "translation": "Invalid allowed domains" + }, + { + "id": "model.team.is_valid.email.app_error", + "translation": "Invalid email" + }, + { + "id": "model.team.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.team.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.team.is_valid.reserved.app_error", + "translation": "This URL is unavailable. Please try another." + }, + { + "id": "model.team.is_valid.type.app_error", + "translation": "Invalid type" + }, + { + "id": "model.team.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.team.is_valid.url.app_error", + "translation": "Invalid URL Identifier" + }, + { + "id": "model.user.is_valid.auth_data.app_error", + "translation": "Invalid auth data" + }, + { + "id": "model.user.is_valid.auth_data_pwd.app_error", + "translation": "Invalid user, password and auth data cannot both be set" + }, + { + "id": "model.user.is_valid.auth_data_type.app_error", + "translation": "Invalid user, auth data must be set with auth type" + }, + { + "id": "model.user.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.user.is_valid.email.app_error", + "translation": "Invalid email" + }, + { + "id": "model.user.is_valid.first_name.app_error", + "translation": "Invalid first name" + }, + { + "id": "model.user.is_valid.id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.user.is_valid.last_name.app_error", + "translation": "Invalid last name" + }, + { + "id": "model.user.is_valid.nickname.app_error", + "translation": "Invalid nickname" + }, + { + "id": "model.user.is_valid.pwd.app_error", + "translation": "Invalid password" + }, + { + "id": "model.user.is_valid.team_id.app_error", + "translation": "Invalid team id" + }, + { + "id": "model.user.is_valid.theme.app_error", + "translation": "Invalid theme" + }, + { + "id": "model.user.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.user.is_valid.username.app_error", + "translation": "Invalid username" + }, + { + "id": "model.utils.decode_json.app_error", + "translation": "could not decode" + }, + { "id": "utils.config.load_config.decoding.panic", "translation": "Error decoding config file={{.Filename}}, err={{.Error}}" }, diff --git a/i18n/es.json b/i18n/es.json index 4ec3eb8d8..57dd22bc8 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -1676,6 +1676,486 @@ "translation": "La versión actual es %v (%v/%v/%v)" }, { + "id": "model.access.is_valid.access_token.app_error", + "translation": "Token de acceso inválido" + }, + { + "id": "model.access.is_valid.auth_code.app_error", + "translation": "Código de autenticación inválido" + }, + { + "id": "model.access.is_valid.redirect_uri.app_error", + "translation": "URI de redireccionamiento inválido" + }, + { + "id": "model.access.is_valid.refresh_token.app_error", + "translation": "Token de refrescamiento inválido" + }, + { + "id": "model.authorize.is_valid.auth_code.app_error", + "translation": "Código de autorización inválido" + }, + { + "id": "model.authorize.is_valid.client_id.app_error", + "translation": "Id de cliente inválido" + }, + { + "id": "model.authorize.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.authorize.is_valid.expires.app_error", + "translation": "Se debe asignar el tiempo de Expiración" + }, + { + "id": "model.authorize.is_valid.redirect_uri.app_error", + "translation": "URI de redireccionamiento inválido" + }, + { + "id": "model.authorize.is_valid.scope.app_error", + "translation": "Alcance inválido" + }, + { + "id": "model.authorize.is_valid.state.app_error", + "translation": "Estado inválido" + }, + { + "id": "model.authorize.is_valid.user_id.app_error", + "translation": "Usuario id inválido" + }, + { + "id": "model.channel.is_valid.2_or_more.app_error", + "translation": "Debe tener 2 o más caracteres alfanuméricos en minúscula" + }, + { + "id": "model.channel.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.channel.is_valid.creator_id.app_error", + "translation": "Id del creador inválido" + }, + { + "id": "model.channel.is_valid.display_name.app_error", + "translation": "Nombre a mostrar inválido" + }, + { + "id": "model.channel.is_valid.header.app_error", + "translation": "Encabezado inválido" + }, + { + "id": "model.channel.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.channel.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.channel.is_valid.purpose.app_error", + "translation": "Propósito inválido" + }, + { + "id": "model.channel.is_valid.type.app_error", + "translation": "Tipo inválido" + }, + { + "id": "model.channel.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.channel_member.is_valid.channel_id.app_error", + "translation": "Channel id inválido" + }, + { + "id": "model.channel_member.is_valid.notify_level.app_error", + "translation": "Nivel de notificación inválido" + }, + { + "id": "model.channel_member.is_valid.role.app_error", + "translation": "Rol inválido" + }, + { + "id": "model.channel_member.is_valid.unread_level.app_error", + "translation": "Nivel de marca para no leidos inválido" + }, + { + "id": "model.channel_member.is_valid.user_id.app_error", + "translation": "User id inválido" + }, + { + "id": "model.client.connecting.app_error", + "translation": "Encontramos un error mientras conectabamos al servidor" + }, + { + "id": "model.client.login.app_error", + "translation": "Token de autenticación no coincidió" + }, + { + "id": "model.config.is_valid.email_reset_salt.app_error", + "translation": "Salt para restablecer contraseñas en la configuración de correos es inválido. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.email_salt.app_error", + "translation": "Salt para crear invitaciones en la configuración de correos es inválido. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.email_security.app_error", + "translation": "Configuración inválida de seguridad en la configuración de correos. Debe ser '', 'TLS', o 'STARTTLS'" + }, + { + "id": "model.config.is_valid.encrypt_sql.app_error", + "translation": "Llave de cifrado rest para las configuraciones de SQL inválida. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.file_driver.app_error", + "translation": "Nombre de controlador para la configuración de archivos es inválido. Debe ser 'local' o 'amazons3'" + }, + { + "id": "model.config.is_valid.file_preview_height.app_error", + "translation": "La altura para la previsualización es inválido en la configuración de archivos. Debe ser cero o un número positivo." + }, + { + "id": "model.config.is_valid.file_preview_width.app_error", + "translation": "El ancho para la previsualización es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_profile_height.app_error", + "translation": "La altura para la imagen de perfil es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_profile_width.app_error", + "translation": "El ancho para la imagen de perfil es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_salt.app_error", + "translation": "Salt para crear enlaces públicos en la configuración a archivos es inválido. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.file_thumb_height.app_error", + "translation": "La altura para la imagen de miniatura es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_thumb_width.app_error", + "translation": "El ancho para la imagen de miniatura es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.listen_address.app_error", + "translation": "Dirección dónde se escuchará el servicio en la configuracón del servicio debe ser asignada." + }, + { + "id": "model.config.is_valid.login_attempts.app_error", + "translation": "Número inválido de máximos intentos de inició de sesión en la configuración del servicio. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.max_users.app_error", + "translation": "Número inválido del máximo de usuarios por equipo en la configuración de equipo. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.rate_mem.app_error", + "translation": "Tamaño del almacen de memoria inválido en la configuración de límites de velocidad. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.rate_sec.app_error", + "translation": "Por segundo es inválido en la configuración de límites de velocidad. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.sql_data_src.app_error", + "translation": "Fuente de datos no válido para la configuración de SQL. Debe ser asignado." + }, + { + "id": "model.config.is_valid.sql_driver.app_error", + "translation": "Nombre del controlador no válido para la configuración de SQL. Debe ser 'mysql' o 'postgres'" + }, + { + "id": "model.config.is_valid.sql_idle.app_error", + "translation": "Inválido máxima de conexión inactiva para la configuración de SQL. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.sql_max_conn.app_error", + "translation": "Inválida cantidad de conexiones abiertas para la configuración de SQL. Debe ser un número positivo." + }, + { + "id": "model.file_info.get.gif.app_error", + "translation": "No se pudo decodificar el gif." + }, + { + "id": "model.incoming_hook.channel_id.app_error", + "translation": "Channel id inválido" + }, + { + "id": "model.incoming_hook.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.incoming_hook.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.incoming_hook.team_id.app_error", + "translation": "Id del Equipo inválido" + }, + { + "id": "model.incoming_hook.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.incoming_hook.user_id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.oauth.is_valid.app_id.app_error", + "translation": "Id de la App inválido" + }, + { + "id": "model.oauth.is_valid.callback.app_error", + "translation": "Callback urls inválido" + }, + { + "id": "model.oauth.is_valid.client_secret.app_error", + "translation": "Llave secreta del Cliente no es válida" + }, + { + "id": "model.oauth.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.oauth.is_valid.creator_id.app_error", + "translation": "Id del credor no es válido" + }, + { + "id": "model.oauth.is_valid.description.app_error", + "translation": "Descripción inválida" + }, + { + "id": "model.oauth.is_valid.homepage.app_error", + "translation": "Página principal inválida" + }, + { + "id": "model.oauth.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.oauth.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.outgoing_hook.is_valid.callback.app_error", + "translation": "Callback urls inválido" + }, + { + "id": "model.outgoing_hook.is_valid.channel_id.app_error", + "translation": "Id del Canal inválido" + }, + { + "id": "model.outgoing_hook.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.outgoing_hook.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.outgoing_hook.is_valid.team_id.app_error", + "translation": "Id del Equipo inválido" + }, + { + "id": "model.outgoing_hook.is_valid.token.app_error", + "translation": "Token inválido" + }, + { + "id": "model.outgoing_hook.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.outgoing_hook.is_valid.url.app_error", + "translation": "Callback URLs inválido. Cada uno debe ser un URL válido y que comience con http:// o https://" + }, + { + "id": "model.outgoing_hook.is_valid.user_id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.outgoing_hook.is_valid.words.app_error", + "translation": "Palabras gatilladoras inválidas" + }, + { + "id": "model.post.is_valid.channel_id.app_error", + "translation": "Id del Canal inválido" + }, + { + "id": "model.post.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.post.is_valid.filenames.app_error", + "translation": "Nombre de archivos no válidos" + }, + { + "id": "model.post.is_valid.hashtags.app_error", + "translation": "Hashtags inválidos" + }, + { + "id": "model.post.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.post.is_valid.msg.app_error", + "translation": "Mensaje no es válido" + }, + { + "id": "model.post.is_valid.original_id.app_error", + "translation": "Id Original inválido" + }, + { + "id": "model.post.is_valid.parent_id.app_error", + "translation": "Id del padre no es válido" + }, + { + "id": "model.post.is_valid.props.app_error", + "translation": "Props inválidos" + }, + { + "id": "model.post.is_valid.root_id.app_error", + "translation": "Id de la raíz no es válido" + }, + { + "id": "model.post.is_valid.root_parent.app_error", + "translation": "Id de la raíz no es válido, debe ser asignado si el Id del padre fue asignado" + }, + { + "id": "model.post.is_valid.type.app_error", + "translation": "Tipo inválido" + }, + { + "id": "model.post.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.post.is_valid.user_id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.preference.is_valid.category.app_error", + "translation": "Categoría inválida" + }, + { + "id": "model.preference.is_valid.id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.preference.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.preference.is_valid.value.app_error", + "translation": "El valor es muy largo" + }, + { + "id": "model.team.is_valid.characters.app_error", + "translation": "Nombre tiene que ser de 4 o más caracteres alfanuméricos en minúsculas" + }, + { + "id": "model.team.is_valid.company.app_error", + "translation": "Inválido nombre de la empresa" + }, + { + "id": "model.team.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.team.is_valid.domains.app_error", + "translation": "Dominios permitidos no válidos" + }, + { + "id": "model.team.is_valid.email.app_error", + "translation": "Correo electrónico inválido" + }, + { + "id": "model.team.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.team.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.team.is_valid.reserved.app_error", + "translation": "Este URL no está disponible. Por favor, prueba con otro." + }, + { + "id": "model.team.is_valid.type.app_error", + "translation": "Tipo inválido" + }, + { + "id": "model.team.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.team.is_valid.url.app_error", + "translation": "Identificador del URL es inválido" + }, + { + "id": "model.user.is_valid.auth_data.app_error", + "translation": "Data de auth es inválida" + }, + { + "id": "model.user.is_valid.auth_data_pwd.app_error", + "translation": "Usuario inválido, no pueden ser asignados auth data y la contraseña al mismo tiempo" + }, + { + "id": "model.user.is_valid.auth_data_type.app_error", + "translation": "Usuario inválido, auth data debe ser asignado con un tipo de auth" + }, + { + "id": "model.user.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.user.is_valid.email.app_error", + "translation": "Correo electrónico inválido" + }, + { + "id": "model.user.is_valid.first_name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.user.is_valid.id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.user.is_valid.last_name.app_error", + "translation": "Apellido no es válido" + }, + { + "id": "model.user.is_valid.nickname.app_error", + "translation": "Sobrenombre no es válido" + }, + { + "id": "model.user.is_valid.pwd.app_error", + "translation": "Contraseña inválida" + }, + { + "id": "model.user.is_valid.team_id.app_error", + "translation": "Id del Equipo inválido" + }, + { + "id": "model.user.is_valid.theme.app_error", + "translation": "Tema inválido" + }, + { + "id": "model.user.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.user.is_valid.username.app_error", + "translation": "Nombre de usuario inválido" + }, + { + "id": "model.utils.decode_json.app_error", + "translation": "no se puede decodificar" + }, + { "id": "utils.config.load_config.decoding.panic", "translation": "Error decifrando la configuración del archivo={{.Filename}}, err={{.Error}}" }, diff --git a/model/access.go b/model/access.go index 6c9254004..877b3c4f0 100644 --- a/model/access.go +++ b/model/access.go @@ -34,19 +34,19 @@ type AccessResponse struct { func (ad *AccessData) IsValid() *AppError { if len(ad.AuthCode) == 0 || len(ad.AuthCode) > 128 { - return NewAppError("AccessData.IsValid", "Invalid auth code", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.auth_code.app_error", nil, "") } if len(ad.Token) != 26 { - return NewAppError("AccessData.IsValid", "Invalid access token", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.access_token.app_error", nil, "") } if len(ad.RefreshToken) > 26 { - return NewAppError("AccessData.IsValid", "Invalid refresh token", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.refresh_token.app_error", nil, "") } if len(ad.RedirectUri) > 256 { - return NewAppError("AccessData.IsValid", "Invalid redirect uri", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.redirect_uri.app_error", nil, "") } return nil diff --git a/model/authorize.go b/model/authorize.go index 4176a9b89..e0d665bae 100644 --- a/model/authorize.go +++ b/model/authorize.go @@ -29,35 +29,35 @@ type AuthData struct { func (ad *AuthData) IsValid() *AppError { if len(ad.ClientId) != 26 { - return NewAppError("AuthData.IsValid", "Invalid client id", "") + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.client_id.app_error", nil, "") } if len(ad.UserId) != 26 { - return NewAppError("AuthData.IsValid", "Invalid user id", "") + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.user_id.app_error", nil, "") } if len(ad.Code) == 0 || len(ad.Code) > 128 { - return NewAppError("AuthData.IsValid", "Invalid authorization code", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.auth_code.app_error", nil, "client_id="+ad.ClientId) } if ad.ExpiresIn == 0 { - return NewAppError("AuthData.IsValid", "Expires in must be set", "") + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.expires.app_error", nil, "") } if ad.CreateAt <= 0 { - return NewAppError("AuthData.IsValid", "Create at must be a valid time", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.create_at.app_error", nil, "client_id="+ad.ClientId) } if len(ad.RedirectUri) > 256 { - return NewAppError("AuthData.IsValid", "Invalid redirect uri", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.redirect_uri.app_error", nil, "client_id="+ad.ClientId) } if len(ad.State) > 128 { - return NewAppError("AuthData.IsValid", "Invalid state", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.state.app_error", nil, "client_id="+ad.ClientId) } if len(ad.Scope) > 128 { - return NewAppError("AuthData.IsValid", "Invalid scope", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.scope.app_error", nil, "client_id="+ad.ClientId) } return nil diff --git a/model/channel.go b/model/channel.go index 7109500d4..e7002e3cb 100644 --- a/model/channel.go +++ b/model/channel.go @@ -64,43 +64,43 @@ func (o *Channel) ExtraEtag(memberLimit int) string { func (o *Channel) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("Channel.IsValid", "Invalid Id", "") + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("Channel.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("Channel.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.update_at.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.DisplayName) > 64 { - return NewAppError("Channel.IsValid", "Invalid display name", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.display_name.app_error", nil, "id="+o.Id) } if len(o.Name) > 64 { - return NewAppError("Channel.IsValid", "Invalid name", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.name.app_error", nil, "id="+o.Id) } if !IsValidChannelIdentifier(o.Name) { - return NewAppError("Channel.IsValid", "Name must be 2 or more lowercase alphanumeric characters", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.2_or_more.app_error", nil, "id="+o.Id) } if !(o.Type == CHANNEL_OPEN || o.Type == CHANNEL_PRIVATE || o.Type == CHANNEL_DIRECT) { - return NewAppError("Channel.IsValid", "Invalid type", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.type.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.Header) > 1024 { - return NewAppError("Channel.IsValid", "Invalid header", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.header.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.Purpose) > 128 { - return NewAppError("Channel.IsValid", "Invalid purpose", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.purpose.app_error", nil, "id="+o.Id) } if len(o.CreatorId) > 26 { - return NewAppError("Channel.IsValid", "Invalid creator id", "") + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.creator_id.app_error", nil, "") } return nil diff --git a/model/channel_member.go b/model/channel_member.go index e822ba443..66e20da64 100644 --- a/model/channel_member.go +++ b/model/channel_member.go @@ -53,27 +53,29 @@ func ChannelMemberFromJson(data io.Reader) *ChannelMember { func (o *ChannelMember) IsValid() *AppError { if len(o.ChannelId) != 26 { - return NewAppError("ChannelMember.IsValid", "Invalid channel id", "") + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.channel_id.app_error", nil, "") } if len(o.UserId) != 26 { - return NewAppError("ChannelMember.IsValid", "Invalid user id", "") + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.user_id.app_error", nil, "") } for _, role := range strings.Split(o.Roles, " ") { if !(role == "" || role == CHANNEL_ROLE_ADMIN) { - return NewAppError("ChannelMember.IsValid", "Invalid role", "role="+role) + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.role.app_error", nil, "role="+role) } } notifyLevel := o.NotifyProps["desktop"] if len(notifyLevel) > 20 || !IsChannelNotifyLevelValid(notifyLevel) { - return NewAppError("ChannelMember.IsValid", "Invalid notify level", "notify_level="+notifyLevel) + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.notify_level.app_error", + nil, "notify_level="+notifyLevel) } markUnreadLevel := o.NotifyProps["mark_unread"] if len(markUnreadLevel) > 20 || !IsChannelMarkUnreadLevelValid(markUnreadLevel) { - return NewAppError("ChannelMember.IsValid", "Invalid mark unread level", "mark_unread_level="+markUnreadLevel) + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.unread_level.app_error", + nil, "mark_unread_level="+markUnreadLevel) } return nil diff --git a/model/client.go b/model/client.go index b8e7c4894..8021c7039 100644 --- a/model/client.go +++ b/model/client.go @@ -56,7 +56,7 @@ func (c *Client) DoPost(url, data, contentType string) (*http.Response, *AppErro rq.Header.Set("Content-Type", contentType) if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -72,7 +72,7 @@ func (c *Client) DoApiPost(url string, data string) (*http.Response, *AppError) } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -92,7 +92,7 @@ func (c *Client) DoApiGet(url string, data string, etag string) (*http.Response, } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode == 304 { return rp, nil } else if rp.StatusCode >= 300 { @@ -298,7 +298,7 @@ func (c *Client) login(m map[string]string) (*Result, *AppError) { sessionToken := getCookie(SESSION_COOKIE_TOKEN, r) if c.AuthToken != sessionToken.Value { - NewAppError("/users/login", "Authentication tokens didn't match", "") + NewLocAppError("/users/login", "model.client.login.app_error", nil, "") } return &Result{r.Header.Get(HEADER_REQUEST_ID), @@ -699,7 +699,7 @@ func (c *Client) UploadFile(url string, data []byte, contentType string) (*Resul } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -721,7 +721,7 @@ func (c *Client) GetFile(url string, isFullUrl bool) (*Result, *AppError) { } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -739,7 +739,7 @@ func (c *Client) GetFileInfo(url string) (*Result, *AppError) { } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { diff --git a/model/config.go b/model/config.go index 640eb49e5..5c8604ff1 100644 --- a/model/config.go +++ b/model/config.go @@ -345,87 +345,87 @@ func (o *Config) SetDefaults() { func (o *Config) IsValid() *AppError { if o.ServiceSettings.MaximumLoginAttempts <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum login attempts for service settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.login_attempts.app_error", nil, "") } if len(o.ServiceSettings.ListenAddress) == 0 { - return NewAppError("Config.IsValid", "Invalid listen address for service settings Must be set.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.listen_address.app_error", nil, "") } if o.TeamSettings.MaxUsersPerTeam <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum users per team for team settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.max_users.app_error", nil, "") } if len(o.SqlSettings.AtRestEncryptKey) < 32 { - return NewAppError("Config.IsValid", "Invalid at rest encrypt key for SQL settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.encrypt_sql.app_error", nil, "") } if !(o.SqlSettings.DriverName == DATABASE_DRIVER_MYSQL || o.SqlSettings.DriverName == DATABASE_DRIVER_POSTGRES) { - return NewAppError("Config.IsValid", "Invalid driver name for SQL settings. Must be 'mysql' or 'postgres'", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_driver.app_error", nil, "") } if o.SqlSettings.MaxIdleConns <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum idle connection for SQL settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_idle.app_error", nil, "") } if len(o.SqlSettings.DataSource) == 0 { - return NewAppError("Config.IsValid", "Invalid data source for SQL settings. Must be set.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_data_src.app_error", nil, "") } if o.SqlSettings.MaxOpenConns <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum open connection for SQL settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_max_conn.app_error", nil, "") } if !(o.FileSettings.DriverName == IMAGE_DRIVER_LOCAL || o.FileSettings.DriverName == IMAGE_DRIVER_S3) { - return NewAppError("Config.IsValid", "Invalid driver name for file settings. Must be 'local' or 'amazons3'", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_driver.app_error", nil, "") } if o.FileSettings.PreviewHeight < 0 { - return NewAppError("Config.IsValid", "Invalid preview height for file settings. Must be a zero or positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_preview_height.app_error", nil, "") } if o.FileSettings.PreviewWidth <= 0 { - return NewAppError("Config.IsValid", "Invalid preview width for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_preview_width.app_error", nil, "") } if o.FileSettings.ProfileHeight <= 0 { - return NewAppError("Config.IsValid", "Invalid profile height for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_profile_height.app_error", nil, "") } if o.FileSettings.ProfileWidth <= 0 { - return NewAppError("Config.IsValid", "Invalid profile width for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_profile_width.app_error", nil, "") } if o.FileSettings.ThumbnailHeight <= 0 { - return NewAppError("Config.IsValid", "Invalid thumbnail height for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_thumb_height.app_error", nil, "") } - if o.FileSettings.ThumbnailHeight <= 0 { - return NewAppError("Config.IsValid", "Invalid thumbnail width for file settings. Must be a positive number.", "") + if o.FileSettings.ThumbnailWidth <= 0 { + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_thumb_width.app_error", nil, "") } if len(o.FileSettings.PublicLinkSalt) < 32 { - return NewAppError("Config.IsValid", "Invalid public link salt for file settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_salt.app_error", nil, "") } if !(o.EmailSettings.ConnectionSecurity == CONN_SECURITY_NONE || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_TLS || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_STARTTLS) { - return NewAppError("Config.IsValid", "Invalid connection security for email settings. Must be '', 'TLS', or 'STARTTLS'", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_security.app_error", nil, "") } if len(o.EmailSettings.InviteSalt) < 32 { - return NewAppError("Config.IsValid", "Invalid invite salt for email settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_salt.app_error", nil, "") } if len(o.EmailSettings.PasswordResetSalt) < 32 { - return NewAppError("Config.IsValid", "Invalid password reset salt for email settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_reset_salt.app_error", nil, "") } if o.RateLimitSettings.MemoryStoreSize <= 0 { - return NewAppError("Config.IsValid", "Invalid memory store size for rate limit settings. Must be a positive number", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_mem.app_error", nil, "") } if o.RateLimitSettings.PerSec <= 0 { - return NewAppError("Config.IsValid", "Invalid per sec for rate limit settings. Must be a positive number", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_sec.app_error", nil, "") } return nil diff --git a/model/file_info.go b/model/file_info.go index 741b4e55d..131baff6d 100644 --- a/model/file_info.go +++ b/model/file_info.go @@ -36,7 +36,7 @@ func GetInfoForBytes(filename string, data []byte) (*FileInfo, *AppError) { if mimeType == "image/gif" { // just show the gif itself instead of a preview image for animated gifs if gifImage, err := gif.DecodeAll(bytes.NewReader(data)); err != nil { - return nil, NewAppError("GetInfoForBytes", "Could not decode gif.", "filename="+filename) + return nil, NewLocAppError("GetInfoForBytes", "model.file_info.get.gif.app_error", nil, "filename="+filename) } else { hasPreviewImage = len(gifImage.Image) == 1 } diff --git a/model/incoming_webhook.go b/model/incoming_webhook.go index 8ead0da9f..8432f5fea 100644 --- a/model/incoming_webhook.go +++ b/model/incoming_webhook.go @@ -76,27 +76,27 @@ func IncomingWebhookListFromJson(data io.Reader) []*IncomingWebhook { func (o *IncomingWebhook) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid Id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("IncomingWebhook.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("IncomingWebhook.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.update_at.app_error", nil, "id="+o.Id) } if len(o.UserId) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid user id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.user_id.app_error", nil, "") } if len(o.ChannelId) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid channel id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.channel_id.app_error", nil, "") } if len(o.TeamId) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid channel id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.team_id.app_error", nil, "") } return nil diff --git a/model/oauth.go b/model/oauth.go index 8336e26ba..c54df107c 100644 --- a/model/oauth.go +++ b/model/oauth.go @@ -34,39 +34,39 @@ type OAuthApp struct { func (a *OAuthApp) IsValid() *AppError { if len(a.Id) != 26 { - return NewAppError("OAuthApp.IsValid", "Invalid app id", "") + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.app_id.app_error", nil, "") } if a.CreateAt == 0 { - return NewAppError("OAuthApp.IsValid", "Create at must be a valid time", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.create_at.app_error", nil, "app_id="+a.Id) } if a.UpdateAt == 0 { - return NewAppError("OAuthApp.IsValid", "Update at must be a valid time", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.update_at.app_error", nil, "app_id="+a.Id) } if len(a.CreatorId) != 26 { - return NewAppError("OAuthApp.IsValid", "Invalid creator id", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.creator_id.app_error", nil, "app_id="+a.Id) } if len(a.ClientSecret) == 0 || len(a.ClientSecret) > 128 { - return NewAppError("OAuthApp.IsValid", "Invalid client secret", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.client_secret.app_error", nil, "app_id="+a.Id) } if len(a.Name) == 0 || len(a.Name) > 64 { - return NewAppError("OAuthApp.IsValid", "Invalid name", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.name.app_error", nil, "app_id="+a.Id) } if len(a.CallbackUrls) == 0 || len(fmt.Sprintf("%s", a.CallbackUrls)) > 1024 { - return NewAppError("OAuthApp.IsValid", "Invalid callback urls", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.callback.app_error", nil, "app_id="+a.Id) } if len(a.Homepage) == 0 || len(a.Homepage) > 256 { - return NewAppError("OAuthApp.IsValid", "Invalid homepage", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.homepage.app_error", nil, "app_id="+a.Id) } if utf8.RuneCountInString(a.Description) > 512 { - return NewAppError("OAuthApp.IsValid", "Invalid description", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.description.app_error", nil, "app_id="+a.Id) } return nil diff --git a/model/outgoing_webhook.go b/model/outgoing_webhook.go index 0b4fd6bbe..70de4d26e 100644 --- a/model/outgoing_webhook.go +++ b/model/outgoing_webhook.go @@ -65,44 +65,44 @@ func OutgoingWebhookListFromJson(data io.Reader) []*OutgoingWebhook { func (o *OutgoingWebhook) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid Id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.id.app_error", nil, "") } if len(o.Token) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid token", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.token.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("OutgoingWebhook.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("OutgoingWebhook.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.update_at.app_error", nil, "id="+o.Id) } if len(o.CreatorId) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid user id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.user_id.app_error", nil, "") } if len(o.ChannelId) != 0 && len(o.ChannelId) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid channel id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.channel_id.app_error", nil, "") } if len(o.TeamId) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid team id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.team_id.app_error", nil, "") } if len(fmt.Sprintf("%s", o.TriggerWords)) > 1024 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid trigger words", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.words.app_error", nil, "") } if len(o.CallbackURLs) == 0 || len(fmt.Sprintf("%s", o.CallbackURLs)) > 1024 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid callback urls", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.callback.app_error", nil, "") } for _, callback := range o.CallbackURLs { if !IsValidHttpUrl(callback) { - return NewAppError("OutgoingWebhook.IsValid", "Invalid callback URLs. Each must be a valid URL and start with http:// or https://", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.url.app_error", nil, "") } } diff --git a/model/post.go b/model/post.go index 5c86ce70d..f9f5a4d1c 100644 --- a/model/post.go +++ b/model/post.go @@ -62,60 +62,60 @@ func (o *Post) Etag() string { func (o *Post) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("Post.IsValid", "Invalid Id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("Post.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("Post.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.update_at.app_error", nil, "id="+o.Id) } if len(o.UserId) != 26 { - return NewAppError("Post.IsValid", "Invalid user id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.user_id.app_error", nil, "") } if len(o.ChannelId) != 26 { - return NewAppError("Post.IsValid", "Invalid channel id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.channel_id.app_error", nil, "") } if !(len(o.RootId) == 26 || len(o.RootId) == 0) { - return NewAppError("Post.IsValid", "Invalid root id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.root_id.app_error", nil, "") } if !(len(o.ParentId) == 26 || len(o.ParentId) == 0) { - return NewAppError("Post.IsValid", "Invalid parent id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.parent_id.app_error", nil, "") } if len(o.ParentId) == 26 && len(o.RootId) == 0 { - return NewAppError("Post.IsValid", "Invalid root id must be set if parent id set", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.root_parent.app_error", nil, "") } if !(len(o.OriginalId) == 26 || len(o.OriginalId) == 0) { - return NewAppError("Post.IsValid", "Invalid original id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.original_id.app_error", nil, "") } if utf8.RuneCountInString(o.Message) > 4000 { - return NewAppError("Post.IsValid", "Invalid message", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.msg.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.Hashtags) > 1000 { - return NewAppError("Post.IsValid", "Invalid hashtags", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.hashtags.app_error", nil, "id="+o.Id) } // should be removed once more message types are supported if !(o.Type == POST_DEFAULT || o.Type == POST_JOIN_LEAVE || o.Type == POST_SLACK_ATTACHMENT || o.Type == POST_HEADER_CHANGE) { - return NewAppError("Post.IsValid", "Invalid type", "id="+o.Type) + return NewLocAppError("Post.IsValid", "model.post.is_valid.type.app_error", nil, "id="+o.Type) } if utf8.RuneCountInString(ArrayToJson(o.Filenames)) > 4000 { - return NewAppError("Post.IsValid", "Invalid filenames", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(StringInterfaceToJson(o.Props)) > 8000 { - return NewAppError("Post.IsValid", "Invalid props", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.props.app_error", nil, "id="+o.Id) } return nil diff --git a/model/preference.go b/model/preference.go index e3ad23ed4..b2ec93105 100644 --- a/model/preference.go +++ b/model/preference.go @@ -47,19 +47,19 @@ func PreferenceFromJson(data io.Reader) *Preference { func (o *Preference) IsValid() *AppError { if len(o.UserId) != 26 { - return NewAppError("Preference.IsValid", "Invalid user id", "user_id="+o.UserId) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.id.app_error", nil, "user_id="+o.UserId) } if len(o.Category) == 0 || len(o.Category) > 32 { - return NewAppError("Preference.IsValid", "Invalid category", "category="+o.Category) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.category.app_error", nil, "category="+o.Category) } if len(o.Name) == 0 || len(o.Name) > 32 { - return NewAppError("Preference.IsValid", "Invalid name", "name="+o.Name) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.name.app_error", nil, "name="+o.Name) } if utf8.RuneCountInString(o.Value) > 128 { - return NewAppError("Preference.IsValid", "Value is too long", "value="+o.Value) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.value.app_error", nil, "value="+o.Value) } return nil diff --git a/model/team.go b/model/team.go index e7dde4766..9e9eaa25f 100644 --- a/model/team.go +++ b/model/team.go @@ -104,51 +104,51 @@ func (o *Team) Etag() string { func (o *Team) IsValid(restrictTeamNames bool) *AppError { if len(o.Id) != 26 { - return NewAppError("Team.IsValid", "Invalid Id", "") + return NewLocAppError("Team.IsValid", "model.team.is_valid.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("Team.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("Team.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.update_at.app_error", nil, "id="+o.Id) } if len(o.Email) > 128 { - return NewAppError("Team.IsValid", "Invalid email", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.email.app_error", nil, "id="+o.Id) } if len(o.Email) > 0 && !IsValidEmail(o.Email) { - return NewAppError("Team.IsValid", "Invalid email", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.email.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.DisplayName) == 0 || utf8.RuneCountInString(o.DisplayName) > 64 { - return NewAppError("Team.IsValid", "Invalid name", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.name.app_error", nil, "id="+o.Id) } if len(o.Name) > 64 { - return NewAppError("Team.IsValid", "Invalid URL Identifier", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.url.app_error", nil, "id="+o.Id) } if restrictTeamNames && IsReservedTeamName(o.Name) { - return NewAppError("Team.IsValid", "This URL is unavailable. Please try another.", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.reserved.app_error", nil, "id="+o.Id) } if !IsValidTeamName(o.Name) { - return NewAppError("Team.IsValid", "Name must be 4 or more lowercase alphanumeric characters", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.characters.app_error", nil, "id="+o.Id) } if !(o.Type == TEAM_OPEN || o.Type == TEAM_INVITE) { - return NewAppError("Team.IsValid", "Invalid type", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.type.app_error", nil, "id="+o.Id) } if len(o.CompanyName) > 64 { - return NewAppError("Team.IsValid", "Invalid company name", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.company.app_error", nil, "id="+o.Id) } if len(o.AllowedDomains) > 500 { - return NewAppError("Team.IsValid", "Invalid allowed domains", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.domains.app_error", nil, "id="+o.Id) } return nil diff --git a/model/user.go b/model/user.go index 44228d93f..675a1ded6 100644 --- a/model/user.go +++ b/model/user.go @@ -61,59 +61,59 @@ type User struct { func (u *User) IsValid() *AppError { if len(u.Id) != 26 { - return NewAppError("User.IsValid", "Invalid user id", "") + return NewLocAppError("User.IsValid", "model.user.is_valid.id.app_error", nil, "") } if u.CreateAt == 0 { - return NewAppError("User.IsValid", "Create at must be a valid time", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.create_at.app_error", nil, "user_id="+u.Id) } if u.UpdateAt == 0 { - return NewAppError("User.IsValid", "Update at must be a valid time", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.update_at.app_error", nil, "user_id="+u.Id) } if len(u.TeamId) != 26 { - return NewAppError("User.IsValid", "Invalid team id", "") + return NewLocAppError("User.IsValid", "model.user.is_valid.team_id.app_error", nil, "") } if !IsValidUsername(u.Username) { - return NewAppError("User.IsValid", "Invalid username", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.username.app_error", nil, "user_id="+u.Id) } if len(u.Email) > 128 || len(u.Email) == 0 { - return NewAppError("User.IsValid", "Invalid email", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.email.app_error", nil, "user_id="+u.Id) } if utf8.RuneCountInString(u.Nickname) > 64 { - return NewAppError("User.IsValid", "Invalid nickname", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.nickname.app_error", nil, "user_id="+u.Id) } if utf8.RuneCountInString(u.FirstName) > 64 { - return NewAppError("User.IsValid", "Invalid first name", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.first_name.app_error", nil, "user_id="+u.Id) } if utf8.RuneCountInString(u.LastName) > 64 { - return NewAppError("User.IsValid", "Invalid last name", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.last_name.app_error", nil, "user_id="+u.Id) } if len(u.Password) > 128 { - return NewAppError("User.IsValid", "Invalid password", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.pwd.app_error", nil, "user_id="+u.Id) } if len(u.AuthData) > 128 { - return NewAppError("User.IsValid", "Invalid auth data", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data.app_error", nil, "user_id="+u.Id) } if len(u.AuthData) > 0 && len(u.AuthService) == 0 { - return NewAppError("User.IsValid", "Invalid user, auth data must be set with auth type", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_type.app_error", nil, "user_id="+u.Id) } if len(u.Password) > 0 && len(u.AuthData) > 0 { - return NewAppError("User.IsValid", "Invalid user, password and auth data cannot both be set", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_pwd.app_error", nil, "user_id="+u.Id) } if len(u.ThemeProps) > 2000 { - return NewAppError("User.IsValid", "Invalid theme", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.theme.app_error", nil, "user_id="+u.Id) } return nil diff --git a/model/utils.go b/model/utils.go index a18ca760e..70b7e3bbd 100644 --- a/model/utils.go +++ b/model/utils.go @@ -67,7 +67,7 @@ func AppErrorFromJson(data io.Reader) *AppError { if err == nil { return &er } else { - return NewAppError("AppErrorFromJson", "could not decode", err.Error()) + return NewLocAppError("AppErrorFromJson", "model.utils.decode_json.app_error", nil, err.Error()) } } |