[Kimchi-devel] [PATCH V5 3/7] Update the i18n tmpl to produce JSON

Aline Manera alinefm at linux.vnet.ibm.com
Mon Jun 9 19:25:31 UTC 2014


Oh.. now my questions about the JSON are answered! =)

On 06/09/2014 07:09 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> Remove html tags from i18n as they are not valid
> Correct object definition from acceptable JS to valid JSON replacing
> ' with " in attribute names.
> Update root.py to make Cheetah render the JSON template.
>
> Signed-off-by: Adam King <rak at linux.vnet.ibm.com>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   ui/pages/i18n.html.tmpl | 178 ------------------------------------------------
>   ui/pages/i18n.json.tmpl | 165 ++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 165 insertions(+), 178 deletions(-)
>   delete mode 100644 ui/pages/i18n.html.tmpl
>   create mode 100644 ui/pages/i18n.json.tmpl
>
> diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
> deleted file mode 100644
> index 25b81c2..0000000
> --- a/ui/pages/i18n.html.tmpl
> +++ /dev/null
> @@ -1,178 +0,0 @@
> -#*
> - * Project Kimchi
> - *
> - * Copyright IBM, Corp. 2013
> - *
> - * Licensed under the Apache License, Version 2.0 (the "License");
> - * you may not use this file except in compliance with the License.
> - * You may obtain a copy of the License at
> - *
> - *     http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> - * See the License for the specific language governing permissions and
> - * limitations under the License.
> - *#
> -#unicode UTF-8
> -#import gettext
> -#from kimchi.cachebust import href
> -#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang)
> -#silent _ = t.gettext
> -#silent _t = t.gettext
> -
> -<!DOCTYPE html>
> -<html class="no-js" lang=$lang.lang[0]>
> -<head>
> -    <meta charset="utf-8">
> -    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
> -    <title>language</title>
> -</head>
> -<body>
> -<script>
> -var i18n = {
> -    'KCHAUTH6001E': "$_("The username or password you entered is incorrect. Please try again.")",
> -    'KCHAUTH6002E': "$_("This field is required.")",
> -
> -    'KCHAUTH6001M': "$_("Log in")",
> -    'KCHAUTH6002M': "$_("Logging in...")",
> -
> -    'Host': "$_("Host")",
> -    'Guests': "$_("Guests")",
> -    'Templates': "$_("Templates")",
> -    'Storage': "$_("Storage")",
> -    'Network': "$_("Network")",
> -
> -    'KCHAPI6001E': "$_("Invalid URL. Redireced to home page.")",
> -    'KCHAPI6002E': "$_("Failed to get application configuration")",
> -    'KCHAPI6003E': "$_("This is not a valid Linux path")",
> -    'KCHAPI6004E': "$_("This is not a valid URL.")",
> -    'KCHAPI6005E': "$_("No such data available.")",
> -    'KCHAPI6006E': "$_("options needed.")",
> -    'KCHAPI6007E': "$_("Can not contact the host system. Verify the host system is up and that you have network connectivity to it. HTTP request response %1. ")",
> -
> -    'KCHAPI6001M': "$_("Delete Confirmation")",
> -    'KCHAPI6002M': "$_("OK")",
> -    'KCHAPI6003M': "$_("Cancel")",
> -    'KCHAPI6004M': "$_("Confirm")",
> -    'KCHAPI6005M': "$_("Create")",
> -    'KCHAPI6006M': "$_("Warning")",
> -    'KCHAPI6007M': "$_("Save")",
> -
> -    'KCHGRD6001M': "$_("Loading...")",
> -    'KCHGRD6002M': "$_("An error occurs while checking for packages update.")",
> -    'KCHGRD6003M': "$_("Retry")",
> -    'KCHGRD6004M': "$_("Detailed message:")",
> -
> -    'KCHTMPL6001W': "$_("No iso found")",
> -
> -    'KCHTMPL6002E': "$_("This is not a valid ISO file.")",
> -
> -    'KCHTMPL6002M': "$_("It will take long time. Do you want to continue?")",
> -    'KCHTMPL6003M': "$_("This will permanently delete the template. Would you like to continue?")",
> -
> -    'KCHHOST6001E': "$_("Unable to shut down system as there are some virtual machines running!")",
> -
> -    'KCHHOST6001M': "$_("Max:")",
> -    'KCHHOST6002M': "$_("Utilization")",
> -    'KCHHOST6003M': "$_("Available")",
> -    'KCHHOST6004M': "$_("Read Rate")",
> -    'KCHHOST6005M': "$_("Write Rate")",
> -    'KCHHOST6006M': "$_("Received")",
> -    'KCHHOST6007M': "$_("Sent")",
> -    'KCHHOST6008M': "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")",
> -
> -
> -    'KCHREPO6001M': "$_("Confirm")",
> -    'KCHREPO6002M': "$_("Repository will be removed permanently and can't be recovered. Do you want to continue?")",
> -    'KCHREPO6003M': "$_("Repositories")",
> -    'KCHREPO6004M': "$_("ID")",
> -    'KCHREPO6005M': "$_("Name")",
> -    'KCHREPO6006M': "$_("Base URL")",
> -    'KCHREPO6007M': "$_("Is Mirror")",
> -    'KCHREPO6008M': "$_("URL Args")",
> -    'KCHREPO6009M': "$_("Enabled")",
> -    'KCHREPO6010M': "$_("GPG Check")",
> -    'KCHREPO6011M': "$_("GPG Key")",
> -    'KCHREPO6012M': "$_("Add")",
> -    'KCHREPO6013M': "$_("Edit")",
> -    'KCHREPO6014M': "$_("Remove")",
> -    'KCHREPO6015M': "$_("Failed.")",
> -    'KCHREPO6016M': "$_("Enable")",
> -    'KCHREPO6017M': "$_("Disable")",
> -
> -
> -    'KCHUPD6001M': "$_("Software Updates")",
> -    'KCHUPD6002M': "$_("Package Name")",
> -    'KCHUPD6003M': "$_("Version")",
> -    'KCHUPD6004M': "$_("Architecture")",
> -    'KCHUPD6005M': "$_("Repository")",
> -    'KCHUPD6006M': "$_("Update All")",
> -    'KCHUPD6007M': "$_("Updating...")",
> -    'KCHUPD6008M': "$_("Failed to retrieve updates.")",
> -    'KCHUPD6009M': "$_("Failed to update package(s).")",
> -
> -
> -    'KCHDR6001M': "$_("Debug report will be removed permanently and can't be recovered. Do you want to continue?")",
> -    'KCHDR6002M': "$_("Debug Reports")",
> -    'KCHDR6003M': "$_("Name")",
> -    'KCHDR6005M': "$_("Generated Time")",
> -    'KCHDR6006M': "$_("Generate")",
> -    'KCHDR6007M': "$_("Generating...")",
> -    'KCHDR6008M': "$_("Rename")",
> -    'KCHDR6009M': "$_("Remove")",
> -    'KCHDR6010M': "$_("Download")",
> -    'KCHDR6011M': "$_("Report name should contain only letters, digits and/or hyphen ('-').")",
> -
> -    'KCHVM6001M': "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
> -    'KCHVM6002M': "$_("Power off Confirmation")",
> -    'KCHVM6003M': "$_("This action may produce undesirable results, "
> -                      "for example unflushed disk cache in the guest. "
> -                      "Would you like to continue?")",
> -    'KCHVM6004M': "$_("Reset Confirmation")",
> -    'KCHVM6005M': "$_("There is a risk of data loss caused by reset without"
> -                      " the guest OS shutdown. Would you like to continue?")",
> -    'KCHVM6006M': "$_("Shut Down Confirmation")",
> -    'KCHVM6007M': "$_("Note the guest OS may ignore this request. Would you like to continue?")",
> -    'KCHVM6008M': "$_("VM Delete Confirmation")",
> -
> -    'KCHVMCD6001M': "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")",
> -    'KCHVMCD6002M': "$_("Attach")",
> -    'KCHVMCD6003M': "$_("Attaching...")",
> -    'KCHVMCD6004M': "$_("Replace")",
> -    'KCHVMCD6005M': "$_("Replacing...")",
> -    'KCHVMCD6006M': "$_("Successfully attached!")",
> -    'KCHVMCD6007M': "$_("Successfully replaced!")",
> -    'KCHVMCD6008M': "$_("Successfully detached!")",
> -
> -
> -    'KCHNET6001E': "$_("The VLAN id must be between 1 and 4094.")",
> -
> -    'KCHNET6001M': "$_("unavailable")",
> -    'KCHNET6002M': "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")",
> -    'KCHNET6003M': "$_("Create a network")",
> -    'KCHNET6004M': "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")",
> -
> -    'KCHPOOL6001M': "$_("This will permanently delete the storage pool. Would you like to continue?")",
> -    'KCHPOOL6002M': "$_("This storage pool is empty.")",
> -    'KCHPOOL6003M': "$_("It will format your disk and you will loose any data in there, are you sure to continue? ")",
> -    'KCHPOOL6004M': "$_("SCSI Fibre Channel")",
> -    'KCHPOOL6005M': "$_("No SCSI adapters found.")",
> -
> -    'KCHPOOL6001E': "$_("The storage pool name can not be blank.")",
> -    'KCHPOOL6002E': "$_("The storage pool path can not be blank.")",
> -    'KCHPOOL6003E': "$_("NFS server mount path can not be blank.")",
> -    'KCHPOOL6004E': "$_("Invalid storage pool name. It should not contain '/'.")",
> -    'KCHPOOL6005E': "$_("Invalid NFS mount path.")",
> -    'KCHPOOL6006E': "$_("No logical device selected.")",
> -    'KCHPOOL6007E': "$_("The iSCSI target can not be blank.")",
> -    'KCHPOOL6008E': "$_("Server name can not be blank.")",
> -    'KCHPOOL6009E': "$_("This is not a valid Server Name or IP. please, modify it.")",
> -    'KCHPOOL6010M': "$_("Looking for available partitions ...")",
> -    'KCHPOOL6011M': "$_("No available partitions found.")",
> -    'KCHPOOL6012M': "$_("This storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")"
> -};
> -</script>
> -</body>
> -</html>
> diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
> new file mode 100644
> index 0000000..3ef488f
> --- /dev/null
> +++ b/ui/pages/i18n.json.tmpl
> @@ -0,0 +1,165 @@
> +#*
> + * Project Kimchi
> + *
> + * Copyright IBM, Corp. 2013
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + *#
> +#unicode UTF-8
> +#import gettext
> +#from kimchi.cachebust import href
> +#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang)
> +#silent _ = t.gettext
> +#silent _t = t.gettext
> +{
> +    "KCHAUTH6001E": "$_("The username or password you entered is incorrect. Please try again.")",
> +    "KCHAUTH6002E": "$_("This field is required.")",
> +
> +    "KCHAUTH6001M": "$_("Log in")",
> +    "KCHAUTH6002M": "$_("Logging in...")",
> +
> +    "Host": "$_("Host")",
> +    "Guests": "$_("Guests")",
> +    "Templates": "$_("Templates")",
> +    "Storage": "$_("Storage")",
> +    "Network": "$_("Network")",
> +
> +    "KCHAPI6001E": "$_("Invalid URL. Redireced to home page.")",
> +    "KCHAPI6002E": "$_("Failed to get application configuration")",
> +    "KCHAPI6003E": "$_("This is not a valid Linux path")",
> +    "KCHAPI6004E": "$_("This is not a valid URL.")",
> +    "KCHAPI6005E": "$_("No such data available.")",
> +    "KCHAPI6006E": "$_("options needed.")",
> +    "KCHAPI6007E": "$_("Can not contact the host system. Verify the host system is up and that you have network connectivity to it. HTTP request response %1. ")",
> +
> +    "KCHAPI6001M": "$_("Delete Confirmation")",
> +    "KCHAPI6002M": "$_("OK")",
> +    "KCHAPI6003M": "$_("Cancel")",
> +    "KCHAPI6004M": "$_("Confirm")",
> +    "KCHAPI6005M": "$_("Create")",
> +    "KCHAPI6006M": "$_("Warning")",
> +    "KCHAPI6007M": "$_("Save")",
> +
> +    "KCHGRD6001M": "$_("Loading...")",
> +    "KCHGRD6002M": "$_("An error occurs while checking for packages update.")",
> +    "KCHGRD6003M": "$_("Retry")",
> +    "KCHGRD6004M": "$_("Detailed message:")",
> +
> +    "KCHTMPL6001W": "$_("No iso found")",
> +
> +    "KCHTMPL6002E": "$_("This is not a valid ISO file.")",
> +
> +    "KCHTMPL6002M": "$_("It will take long time. Do you want to continue?")",
> +    "KCHTMPL6003M": "$_("This will permanently delete the template. Would you like to continue?")",
> +
> +    "KCHHOST6001E": "$_("Unable to shut down system as there are some virtual machines running!")",
> +
> +    "KCHHOST6001M": "$_("Max:")",
> +    "KCHHOST6002M": "$_("Utilization")",
> +    "KCHHOST6003M": "$_("Available")",
> +    "KCHHOST6004M": "$_("Read Rate")",
> +    "KCHHOST6005M": "$_("Write Rate")",
> +    "KCHHOST6006M": "$_("Received")",
> +    "KCHHOST6007M": "$_("Sent")",
> +    "KCHHOST6008M": "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")",
> +
> +
> +    "KCHREPO6001M": "$_("Confirm")",
> +    "KCHREPO6002M": "$_("Repository will be removed permanently and can't be recovered. Do you want to continue?")",
> +    "KCHREPO6003M": "$_("Repositories")",
> +    "KCHREPO6004M": "$_("ID")",
> +    "KCHREPO6005M": "$_("Name")",
> +    "KCHREPO6006M": "$_("Base URL")",
> +    "KCHREPO6007M": "$_("Is Mirror")",
> +    "KCHREPO6008M": "$_("URL Args")",
> +    "KCHREPO6009M": "$_("Enabled")",
> +    "KCHREPO6010M": "$_("GPG Check")",
> +    "KCHREPO6011M": "$_("GPG Key")",
> +    "KCHREPO6012M": "$_("Add")",
> +    "KCHREPO6013M": "$_("Edit")",
> +    "KCHREPO6014M": "$_("Remove")",
> +    "KCHREPO6015M": "$_("Failed.")",
> +    "KCHREPO6016M": "$_("Enable")",
> +    "KCHREPO6017M": "$_("Disable")",
> +
> +
> +    "KCHUPD6001M": "$_("Software Updates")",
> +    "KCHUPD6002M": "$_("Package Name")",
> +    "KCHUPD6003M": "$_("Version")",
> +    "KCHUPD6004M": "$_("Architecture")",
> +    "KCHUPD6005M": "$_("Repository")",
> +    "KCHUPD6006M": "$_("Update All")",
> +    "KCHUPD6007M": "$_("Updating...")",
> +    "KCHUPD6008M": "$_("Failed to retrieve updates.")",
> +    "KCHUPD6009M": "$_("Failed to update package(s).")",
> +
> +
> +    "KCHDR6001M": "$_("Debug report will be removed permanently and can't be recovered. Do you want to continue?")",
> +    "KCHDR6002M": "$_("Debug Reports")",
> +    "KCHDR6003M": "$_("Name")",
> +    "KCHDR6005M": "$_("Generated Time")",
> +    "KCHDR6006M": "$_("Generate")",
> +    "KCHDR6007M": "$_("Generating...")",
> +    "KCHDR6008M": "$_("Rename")",
> +    "KCHDR6009M": "$_("Remove")",
> +    "KCHDR6010M": "$_("Download")",
> +    "KCHDR6011M": "$_("Report name should contain only letters, digits and/or hyphen ('-').")",
> +
> +    "KCHVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
> +    "KCHVM6002M": "$_("Power off Confirmation")",
> +    "KCHVM6003M": "$_("This action may produce undesirable results, "
> +                      "for example unflushed disk cache in the guest. "
> +                      "Would you like to continue?")",
> +    "KCHVM6004M": "$_("Reset Confirmation")",
> +    "KCHVM6005M": "$_("There is a risk of data loss caused by reset without"
> +                      " the guest OS shutdown. Would you like to continue?")",
> +    "KCHVM6006M": "$_("Shut Down Confirmation")",
> +    "KCHVM6007M": "$_("Note the guest OS may ignore this request. Would you like to continue?")",
> +    "KCHVM6008M": "$_("VM Delete Confirmation")",
> +
> +    "KCHVMCD6001M": "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")",
> +    "KCHVMCD6002M": "$_("Attach")",
> +    "KCHVMCD6003M": "$_("Attaching...")",
> +    "KCHVMCD6004M": "$_("Replace")",
> +    "KCHVMCD6005M": "$_("Replacing...")",
> +    "KCHVMCD6006M": "$_("Successfully attached!")",
> +    "KCHVMCD6007M": "$_("Successfully replaced!")",
> +    "KCHVMCD6008M": "$_("Successfully detached!")",
> +
> +
> +    "KCHNET6001E": "$_("The VLAN id must be between 1 and 4094.")",
> +
> +    "KCHNET6001M": "$_("unavailable")",
> +    "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")",
> +    "KCHNET6003M": "$_("Create a network")",
> +    "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")",
> +
> +    "KCHPOOL6001M": "$_("This will permanently delete the storage pool. Would you like to continue?")",
> +    "KCHPOOL6002M": "$_("This storage pool is empty.")",
> +    "KCHPOOL6003M": "$_("It will format your disk and you will loose any data in there, are you sure to continue? ")",
> +    "KCHPOOL6004M": "$_("SCSI Fibre Channel")",
> +    "KCHPOOL6005M": "$_("No SCSI adapters found.")",
> +
> +    "KCHPOOL6001E": "$_("The storage pool name can not be blank.")",
> +    "KCHPOOL6002E": "$_("The storage pool path can not be blank.")",
> +    "KCHPOOL6003E": "$_("NFS server mount path can not be blank.")",
> +    "KCHPOOL6004E": "$_("Invalid storage pool name. It should not contain '/'.")",
> +    "KCHPOOL6005E": "$_("Invalid NFS mount path.")",
> +    "KCHPOOL6006E": "$_("No logical device selected.")",
> +    "KCHPOOL6007E": "$_("The iSCSI target can not be blank.")",
> +    "KCHPOOL6008E": "$_("Server name can not be blank.")",
> +    "KCHPOOL6009E": "$_("This is not a valid Server Name or IP. please, modify it.")",
> +    "KCHPOOL6010M": "$_("Looking for available partitions ...")",
> +    "KCHPOOL6011M": "$_("No available partitions found.")",
> +    "KCHPOOL6012M": "$_("This storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")"
> +}
> \ No newline at end of file




More information about the Kimchi-devel mailing list