The util_user_message needs to go within the if statement, not right before (otherwise it shows up all the time, which does not make sense). I modified it a bit to allow automatic creation of new pages:
# Item is still empty, try default language for the package
if {$item_id == 0} {
set new_url [export_vars -base "/xowiki/" -url {{edit-new 1} {return_url [ad_return_url]} {object_type "xowiki::Page"} {na\me $name}}]
util_user_message -message "Content is not available in your locale. Create <a href=\"$new_url\" target=new()>new</a>" -ht\ml
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]
}
What I found interesting though is that if I unpublish the item in question (e.g. en:company), the page is still showing up the en:company page, instead of (as I would have assumed) the de:company page with the user notification. If I delete the page in question all is fine.
My assumption is that ::Generic::CrItem lookup -name $name -parent $folder_Id does not query for published items and could use a "-live" flag to query only items which are live. But I won't dive down into these waters :).