Adding language settings to config.php so that people can control the language output of their repository viewer
Adding language settings to config.php so that people can control the language output of their repository viewer
diff --git a/includes/config.php.new b/includes/config.php.new
index 19ff602..dfc7269 100644
--- a/includes/config.php.new
+++ b/includes/config.php.new
@@ -52,6 +52,18 @@ $conf['paths']['web'] = '/viewsvn';
// is in your shell's path, then you can set this to 'svn'.
$conf['paths']['svn'] = '/usr/local/bin/svn';
+// ###################################################################
+// ///////////////////////// LANGUAGE OPTIONS
+// -------------------------------------------------------------------
+// The text encoding to send all the pages as. This should probably
+// remain at UTF8.
+$conf['lang']['encoding'] = 'utf8';
+
+// The language code. This should follow Gettext nomenclature and be
+// the two letter language code (lowercase), an underscore, and the
+// two letter country code (upper case)
+$conf['lang']['code'] = 'en_US';
+
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
diff --git a/includes/init.php b/includes/init.php
index 73d6eae..cd5baad 100644
--- a/includes/init.php
+++ b/includes/init.php
@@ -59,6 +59,8 @@ $template->setExtension('tpl');
// load options
BSRegister::Register('svnpath', $conf['paths']['svn']);
+$language = $conf['lang'];
+
// ###################################################################
// imaginary reporter
require_once('./includes/imaginary.php');
diff --git a/templates/blame.tpl b/templates/blame.tpl
index 5a8160e..2ec967d 100644
--- a/templates/blame.tpl
+++ b/templates/blame.tpl
@@ -1,5 +1,5 @@
$doctype
-<html lang="##LANG##" xml:lang="##XML-LANG##">
+<html lang="$language[code]" xml:lang="$language[code]">
<head>
$headinclude
<link rel="stylesheet" href="{BSRegister::Get('webpath')}/templates/diff.css" media="screen" />
diff --git a/templates/browse.tpl b/templates/browse.tpl
index 0135165..2f4b4f0 100644
--- a/templates/browse.tpl
+++ b/templates/browse.tpl
@@ -1,5 +1,5 @@
$doctype
-<html lang="##LANG##" xml:lang="##XML-LANG##">
+<html lang="$language[code]" xml:lang="$language[code]">
<head>
$headinclude
<title>{@"ViewSVN - Browse"}</title>
diff --git a/templates/diff.tpl b/templates/diff.tpl
index 0db1b1a..65a8075 100644
--- a/templates/diff.tpl
+++ b/templates/diff.tpl
@@ -1,5 +1,5 @@
$doctype
-<html lang="##LANG##" xml:lang="##XML-LANG##">
+<html lang="$language[code]" xml:lang="$language[code]">
<head>
$headinclude
<link rel="stylesheet" href="{BSRegister::Get('webpath')}/templates/diff.css" media="screen" />
diff --git a/templates/headinclude.tpl b/templates/headinclude.tpl
index 2e35dc0..29b1c9d 100644
--- a/templates/headinclude.tpl
+++ b/templates/headinclude.tpl
@@ -1 +1,2 @@
+ <meta http-equiv="Content-Type" content="text/html; charset=$language[encoding]" />
<link rel="stylesheet" href="{BSRegister::Get('webpath')}/templates/main.css" media="screen" />
\ No newline at end of file
diff --git a/templates/index.tpl b/templates/index.tpl
index 40c5e99..5651be3 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -1,5 +1,5 @@
$doctype
-<html lang="##LANG##" xml:lang="##XML-LANG##">
+<html lang="$language[code]" xml:lang="$language[code]">
<head>
$headinclude
<title>{@"ViewSVN - Repositories"}</title>
diff --git a/templates/log.tpl b/templates/log.tpl
index d61c982..c89c8ba 100644
--- a/templates/log.tpl
+++ b/templates/log.tpl
@@ -1,5 +1,5 @@
$doctype
-<html lang="##LANG##" xml:lang="##XML-LANG##">
+<html lang="$language[code]" xml:lang="$language[code]">
<head>
$headinclude
<title>{@"ViewSVN - Log"}</title>
diff --git a/templates/view.tpl b/templates/view.tpl
index 6194c87..3302d86 100644
--- a/templates/view.tpl
+++ b/templates/view.tpl
@@ -1,5 +1,5 @@
$doctype
-<html lang="##LANG##" xml:lang="##XML-LANG##">
+<html lang="$language[code]" xml:lang="$language[code]">
<head>
$headinclude
<link rel="stylesheet" href="{BSRegister::Get('webpath')}/templates/code2.css" media="screen" />