DESTDIR=
#SUBDIRS = bin lib www aplinfo
-SUBDIRS = aplinfo PVE bin www
+SUBDIRS = aplinfo PVE bin www po
DEB=${PACKAGE}_${VERSION}-${PACKAGERELEASE}_all.deb
language_map: {
en: 'English',
- de: 'German'
+ de: 'German',
+ fr: 'French'
},
render_language: function (value) {
# NOTE: Requests to this page are not authenticated
# so we must be very careful here
+my $lang = 'en';
+
my $r = Apache2::RequestUtil->request();
my $username;
my $token = 'null';
if (my $cookie = $r->headers_in->{Cookie}) {
+
+ if (my $newlang = ($cookie =~ /(?:^|\s)PVELangCookie=([^;]*)/)[0]) {
+ if ($newlang =~ m/^[a-f]{2,3}(_A-F{2,3})?$/) {
+ $lang = $newlang;
+ }
+ }
+
my $ticket = PVE::REST::extract_auth_cookie($cookie);
if (($username = PVE::AccessControl::verify_ticket($ticket, 1))) {
$token = PVE::AccessControl::assemble_csrf_prevention_token($username);
PVE.GUIVersion = '$version';
PVE.UserName = '$username';
PVE.CSRFPreventionToken = '$token';
+_EOJS
+
+my $langfile = "/usr/share/pve-manager/ext4/locale/ext-lang-${lang}.js";
+$jssrc .= PVE::Tools::file_get_contents($langfile) if -f $langfile;
+
+my $i18nsrc;
+$langfile = "/usr/share/pve-manager/root/pve-lang-${lang}.js";
+if (-f $langfile) {
+ $i18nsrc = PVE::Tools::file_get_contents($langfile);
+} else {
+ $i18nsrc = 'function gettext(buf) { return buf; }';
+}
+
+$jssrc .= <<_EOJS;
Ext.require(['*', '$workspace']);
_EOJS
-$jssrc .= "";
-
my $page = <<_EOD;
<html>
<head>
<link rel="stylesheet" type="text/css" href="/pve2/ext4/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/pve2/css/ext-pve.css" />
+ <script type="text/javascript">$i18nsrc</script>
<script type="text/javascript" src="/pve2/ext4/ext-all-debug.js"></script>
<script type="text/javascript" src="/pve2/ext4/pvemanagerlib.js"></script>
-
<script type="text/javascript">$jssrc</script>
</head>
--- /dev/null
+Ext.onReady(function() {
+ // fixme: how do we implement i18n?
+ //alert("LOADED LANG DE");
+});
\ No newline at end of file
});
var shutdownBtn = Ext.create('PVE.button.Button', {
- text: 'Shutdown',
+ text: gettext('Shutdown'),
confirmMsg: "Do you really want to shutdown the VM?",
handler: function() {
vm_command('shutdown', { timeout: 30 });
closable: false,
resizable: false,
layout: 'auto',
- title: 'Proxmox VE Login',
+ title: gettext('Proxmox VE Login'),
items: [{
xtype: 'form',
url: '/api2/extjs/access/ticket',
fieldDefaults: {
- labelWidth: 70,
labelAlign: 'right'
},
items: [
{
xtype: 'textfield',
- fieldLabel: 'User name',
+ fieldLabel: gettext('User name'),
name: 'username',
- blankText: "Enter your user name",
+ blankText: gettext("Enter your user name"),
listeners: {
afterrender: function(f) {
// Note: only works if we pass delay 1000
{
xtype: 'textfield',
inputType: 'password',
- fieldLabel: 'Password',
+ fieldLabel: gettext('Password'),
name: 'password',
- blankText: "Enter your password",
+ blankText: gettext("Enter your password"),
listeners: {
specialkey: function(field, e) {
if (e.getKey() === e.ENTER) {
{
xtype: 'pveRealmComboBox',
name: 'realm'
+ },
+ {
+ xtype: 'pveLanguageSelector',
+ fieldLabel: gettext('Language'),
+ value: Ext.util.Cookies.get('PVELangCookie') || 'en',
+ name: 'lang',
+ submitValue: false,
+ listeners: {
+ change: function(t, value) {
+ var dt = Ext.Date.add(new Date(), Ext.Date.YEAR, 10);
+ Ext.util.Cookies.set('PVELangCookie', value, dt);
+ window.location.reload();
+ }
+ }
}
],
buttons: [
{
- text: 'Login',
+ text: gettext('Login'),
handler: function(){
me.onLogon();
}
my $header = << '.';
# SOME DESCRIPTIVE TITLE.
-# Copyright (C) 2008 Proxmox Server Solutions GmbH
+# Copyright (C) 2011 Proxmox Server Solutions GmbH
# This file is distributed under the same license as the pve-manager package.
-# Proxmox Support Team <support@proxmox.com>, 2008.
+# Proxmox Support Team <support@proxmox.com>, 2011.
#
-#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: pve-manager 2\n"
.
$header .= "\"Report-Msgid-Bugs-To: $opts{'msgid-bugs-address'}\\n\"\n" if $opts{'msgid-bugs-address'};
$header .= "\"POT-Creation-Date: $ctime\\n\"\n";
$header .= << '.';
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <support@proxmox.com>\n"
"MIME-Version: 1.0\n"