From 8ab64629d3a091a0ccb6af52c48ee7bb9fd8834d Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 4 Apr 2008 00:05:36 +0000 Subject: Bug 182975: Bugzilla directory structure to be adopted to l10n needs - Patch by A.A. Shimono (himorin) r=LpSolit r=mkanat a=LpSolit --- Bugzilla/Config/Core.pm | 2 +- Bugzilla/Install/Filesystem.pm | 15 ++++++++------- Bugzilla/Install/Util.pm | 14 +++++++++++++- Bugzilla/Template.pm | 10 +++++++++- 4 files changed, 31 insertions(+), 10 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Config/Core.pm b/Bugzilla/Config/Core.pm index a0aca9c9b..b307dd7f5 100644 --- a/Bugzilla/Config/Core.pm +++ b/Bugzilla/Config/Core.pm @@ -56,7 +56,7 @@ sub get_param_list { { name => 'docs_urlbase', type => 't', - default => 'docs/html/', + default => 'docs/%lang%/html/', checker => \&check_url }, diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index a24dc28ca..55a5abce9 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -117,8 +117,9 @@ sub FILESYSTEM { 'install-module.pl' => { perms => $owner_executable }, 'docs/makedocs.pl' => { perms => $owner_executable }, - 'docs/rel_notes.txt' => { perms => $ws_readable }, - 'docs/README.docs' => { perms => $owner_readable }, + 'docs/style.css' => { perms => $ws_readable }, + 'docs/*/rel_notes.txt' => { perms => $ws_readable }, + 'docs/*/README.docs' => { perms => $owner_readable }, "$datadir/bugzilla-update.xml" => { perms => $ws_writeable }, "$datadir/params" => { perms => $ws_writeable }, "$datadir/mailer.testfile" => { perms => $ws_writeable }, @@ -168,17 +169,17 @@ sub FILESYSTEM { dirs => $ws_dir_readable }, t => { files => $owner_readable, dirs => $owner_dir_readable }, - 'docs/html' => { files => $ws_readable, + 'docs/*/html' => { files => $ws_readable, dirs => $ws_dir_readable }, - 'docs/pdf' => { files => $ws_readable, + 'docs/*/pdf' => { files => $ws_readable, dirs => $ws_dir_readable }, - 'docs/txt' => { files => $ws_readable, + 'docs/*/txt' => { files => $ws_readable, dirs => $ws_dir_readable }, - 'docs/images' => { files => $ws_readable, + 'docs/*/images' => { files => $ws_readable, dirs => $ws_dir_readable }, 'docs/lib' => { files => $owner_readable, dirs => $owner_dir_readable }, - 'docs/xml' => { files => $owner_readable, + 'docs/*/xml' => { files => $owner_readable, dirs => $owner_dir_readable }, ); diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index 9aeeca486..4c3754964 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -38,6 +38,7 @@ our @EXPORT_OK = qw( get_version_and_os indicate_progress install_string + include_languages template_include_path vers_cmp get_console_locale @@ -123,7 +124,7 @@ sub install_string { return $string_template; } -sub template_include_path { +sub include_languages { my ($params) = @_; $params ||= {}; @@ -171,7 +172,12 @@ sub template_include_path { if (!grep($_ eq 'en', @usedlanguages)) { push(@usedlanguages, 'en'); } + + return @usedlanguages; +} +sub template_include_path { + my @usedlanguages = include_languages(@_); # Now, we add template directories in the order they will be searched: # First, we add extension template directories, because extension templates @@ -516,6 +522,12 @@ Each extension has its own directory. Note that languages are sorted by the user's preference (as specified in their browser, usually), and extensions are sorted alphabetically. +=item C + +Used by L to determine the languages' list which +are compiled with the browser's I and the languages +of installed templates. + =item C =over diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index b35491f78..8a322fae5 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -36,7 +36,7 @@ use strict; use Bugzilla::Constants; use Bugzilla::Install::Requirements; -use Bugzilla::Install::Util qw(install_string template_include_path); +use Bugzilla::Install::Util qw(install_string template_include_path include_languages); use Bugzilla::Util; use Bugzilla::User; use Bugzilla::Error; @@ -729,6 +729,14 @@ sub create { # Allow templates to access the "corect" URLBase value 'urlbase' => sub { return Bugzilla::Util::correct_urlbase(); }, + # Allow templates to access docs url with users' preferred language + 'docs_urlbase' => sub { + my ($language) = include_languages(); + my $docs_urlbase = Bugzilla->params->{'docs_urlbase'}; + $docs_urlbase =~ s/\%lang\%/$language/; + return $docs_urlbase; + }, + # These don't work as normal constants. DB_MODULE => \&Bugzilla::Constants::DB_MODULE, REQUIRED_MODULES => -- cgit v1.2.3-24-g4f1b