logo

Forward Slash in a View's Key

Here's a little gotcha for you. Say you want a website in four different languages. Each page has four documents - one for each translation.

To get this working you create a view that is sorted on a column whose formula equates to Language +"/"+ Title. An example URL would then be:

database.nsf/pages/en/about?opendocument

Where "pages" is the name of the view. Note that you must include the ?opendocument part. Without this Domino doeseth get very confused. To switch to a different translation of that same document you create a Computed Text area that replaces the /en/ with /de/ or whatever.

This works in Domino 6.0.1 - the server I am developing this client's website on. Imagine my disappointment to find that replicating to my public Domino 6.5 server breaks this feature and I can't demo all my hard work without a re-think of my approach.

I've not bothered checking whether 6.5 does in fact not allow / in a key value. Try searching for it on the forums and see how far you get! Instead I've decided to take the safe route and use a view for each of the four languages - one called "en", another called "de" and so on. The fact that the number of translations is fixed allows me to do this. Otherwise I'd be lost.

Comments

    • avatar
    • laurens
    • Mon 25 Oct 2004 07:06

    Not the solution to your problem, but maybe a solution to the problem:

    What you could do is render the english and the other languages all on one page and hide DIVs depending on the browser language info. I do this with:

    {Link}

    A javascript detects the browserlanguage and loads the appropriate style sheet which only displays the right language. Advantages:

    - simpler structure of your website for maintenance

    - better indexing by Google

    - all languages of one page can be edited in one form

    - easy switch of users between languages on the same page

    • avatar
    • Craig
    • Mon 25 Oct 2004 07:37

    Just given this a quick go, and this seems to work OK on my 6.5 server... with the ?opendocument bit on the end.

    Perhaps there's something else causing the problem.

    • avatar
    • Jake Howlett
    • Mon 25 Oct 2004 08:27

    It sounds like I was saying this is a bug. In fact I don't know whether it is or not. All I know is that I made a new replica and it stopped working. I made the change to get rid of the key with a / and now it works again. This took less time that it would have done to find out why/if/how the mixup happened and what the solution is.

  1. Do you cater for different character set for example english, chinese, thai, japanese?

    • avatar
    • Carl
    • Tue 26 Oct 2004 03:00

    Can you use the encoded version of the forward slash / = %2F ??

  2. Have one view to handle all languages ...

    Create two columns:

    Column 1: Categorised by language.

    Column 2: Sorted by Title.

    You might need to make sure the view's "Collapse all .. " setting isn't enabled - it depends on the situation.

    • avatar
    • zomek
    • Wed 27 Oct 2004 03:20

    Why stick to /language-code/ form? In Domino that form is only a "look-like-directories" feature... So maybe swith to /path/title.language_code form? For example:

    database.nsf/pages/about.en

    database.nsf/pages/about.de

    No slash - no stress ;)

    • avatar
    • Jim Jennett
    • Wed 27 Oct 2004 05:26

    What Carl said. Encode the slash and use the reference as a component of a string. Should work.

  3. Hey....

    Why not just use the query string?

    (e.g. ?opendocument&lang=en )

    Works perfect!

    You have to use one document to store all languages. This is useful to manage content for your site, as you can require the user to enter all languages for the document.

    Also, you can put error recovery in the documents if you want. (i.e. If a document only has an English version and the user is navigating in French, then you can display the English version).

    Ok, so the form to display this will have to do a bit of computation, but your website will always have the correct amount of webpages, although not all languages! (i.e. What if your site navigation links to a language document that the user has not created???)

    You should try these links (NOTE: Built this website about 3 years ago... Uses the same mechanism above).

    {Link}

    {Link}

    {Link}

    {Link}

    Later

    Patrick

    • avatar
    • Erwin
    • Wed 27 Oct 2004 18:27

    Considered this?

    {Link}

    • avatar
    • Jake
    • Thu 28 Oct 2004 08:23

    Thanks guys.

    There's a reason I don't want to use the query string. It's essential for this site that Google indexes it properly. For this reason I want avoid anything after the ? as much as I can. It's generally thought that Google doesn't like pages with Query strings as it thinks they are dynamic and not worth indexing.

  4. Jake,

    Considered folders ?

    Mark

    • avatar
    • Jake
    • Thu 28 Oct 2004 10:17

    No Mark. Should I?

  5. Hey Jake....

    Why do you need to use the "/"...? Why can't you just use an underscore, "_".

    Example:

    database.nsf/pages/en_about?opendocument

    database.nsf/pages/de_about?opendocument

    This way you don't have to use the "?opendocument". Could use ".html".

    Example:

    database.nsf/pages/en_about.html

    database.nsf/pages/de_about.html

    Another thing that you can do is to use a multi-value field for the index. This field will store the language names for the document. (e.g. en_about.html; de_about.html). All you need to do is to get the view to display it as seperate entries!

    You can then:

    1) Use 1 document to store all the languages. Then use 1 form to display the different language in the document (i.e. The URL path will hold the language!)

    OR

    2) Use your seperate documents in the view. Then use 1 form to display the document.

    Hope that helps

    Patrick Niland

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Mon 25 Oct 2004

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content