Somehow my setup seems to be screwed up, but I don't know how:
- package parameter index_page: empty
- package parameter use_connection_locale: 1
- browser setting: language de_DE
- server setting (system locale): de_DE
- xowiki mounted as: xowiki
- package_prefix: /
- You have a page named de:index and a page named en:index
- I have a page de:company but I do NOT have a page en:company
This is my /web/cognovis/www/index.vuh:
# -*- tcl -*-
::xowiki::Package initialize -ad_doc {
This is the resolver for this package. It turns a request into
an object and executes the object with the computed method
@author Gustaf Neumann (mailto:gustaf.neumann@wu-wien.ac.at)
@creation-date July, 2006
@cvs-id $Id: index.vuh,v 1.5 2006/09/15 16:45:00 gustafn Exp $
} -parameter {
{-m view}
{-folder_id:integer 0}
} -url /xowiki[ns_conn url]
::$package_id log "--starting... [ns_conn url] [ns_conn query] \
form vars = [ns_set array [ns_getform]]"
#::$package_id exists_form_parameter creator
#::$package_id log "-- [::xo::cc serialize]"
::$package_id reply_to_user [::$package_id invoke -method $m]
::$package_id log "--i ::$package_id DONE"
ad_script_abort
Now I browse:
- "http://www.cognovis.de";, logged out, browser setting de_DE, I get en:index
- "http://www.cognovis.de";, logged in, user_locale de_DE, I get en:index
- "http://www.cognovis.de/index",logged in, user_locale de_DE, I get de:index
- "http://www.cognovis.de/company";, logged out, I get de:company
- "http://www.cognovis.de/company";, logged in, user_locale en_US, I get "No page 'company' available."
- "http://www.cognovis.de/xowiki/company";, logged in, user_locale en_US, I get "No page 'company' available."
- "http://www.cognovis.de/de/company";, logged in, user_locale en_US, I get de:index
What confuses me now is the fact that it does not default back to de_DE, which is the system wide locale as set in /acs-lang/admin. I managed to fix the fallback by adding the following code to Package instproc resolve_request {-path} { (right after the last if {$item_id == 0} statement where you try the normalized name:
if {$item_id == 0} {
set nname [my normalize_name $name]
set item_id [::Generic::CrItem lookup -name $nname -parent_id $folder_id]
my log "--try $nname -> $item_id"
}
######## New code begins here ############
util_user_message -message "Content is not available in your locale"
# Item is still empty, try default language for the package
if {$item_id == 0} {
set system_locale [lang::system::locale]
set lang [string range $system_locale 0 1]
set name ${lang}:$local_name
set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id]
}
# Item is still empty, try default language for the site
if {$item_id == 0} {
set system_locale [lang::system::locale -site_wide]
set lang [string range $system_locale 0 1]
set name ${lang}:$local_name
set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id]
}
###### New code ends here ########
This results in the (desired) behaviour, that if the content is available in site locale, the site locale is presented, yet the navigation (categories portlet) still only shows the pages which are available in this language. Additionally the user notification shows up.
Maybe this should be made a switch (DefaultToSiteLocaleP) but I won't commit anything anyway until Gustaf could take a look.
Still, the index page is a mistery to me....