Fork me on GitHub

Language in a form (Pagesetter)  Bottom

  • Hello
    I'm working on a site that supports multiple languages, and I would like that, depending on the language chosen by the user, the text shown in a form is written in that language (of course I will have already stored in the database required texts before) I'm not sure which is the variable that indicates the language selected by the user and how is it used in a form.

    On the other hand since long time I give the pain in the ass and I would like to know where to find a handbook for:
    1 What are the system variables
    2 Once I "learnt" programming PHP language, but programming with Zikula seems otherwise, [or perhaps it is something different !], so where can I find literature on that item (programming zith Zikula)
    3 Programming forms with PHP interest me also a lot

    Tanks in advance
  • Thank you for your fast answer, I browsed the link you suggested to me, and it seems that this is useful when you have predefined text, which is stored in a PHP file. What I need is to show "dinamic" text, I mean text that will be stored in the DB.
    So I think it would be enough to handle de language variable (unfortunately I do not know whats its name, lang? language?..)
    And if possible if you can link me to a template that deals with something similar in order to study it.
    Thanks again
  • Are you writing your own module or trying to use/customize an existing one? I think the Content module may have multilingual capabilities, but as far as I know, no other module does.

    In Zikula 1.2.x and the forthcoming Zikula 1.3, the code you are looking for is

    Code

    ZLanguage::getLanguageCode();
  • It is a Pagesetter template

    I've found that

    Code

    <!--[lang]-->
    in a template gives me the language selected by the user, I want something like that

    Code

    <!--[if lang eq 'en_US']--> <--$Text1--> <!--[/if]-->
    <!--[if lang eq 'es_ES']--> <--$Text2--> <!--[/if]-->

    (Where $Text, is a Pagesseter variable text saved in the DB)

    an so on for different languages

    but of course it does not work, something is wrong, I do not know.
    And believe me I have read a lot and serched almost everywhere. It seems to be something very easy, but ...

    How can if work out this situation?



    Edited by peristrema on Jan 06, 2011 - 11:31 AM.
  • sorry, I don't know anything about Pagesetter. at the top of the template, you can insert

    Code

    <!--[pndebug]-->


    and you will see a list of all the template variables.
  • You are mentioning a form in your initial post. For clarity: is this about a form where users submit Pagesetter content, or is it about a template used to display a Pagesetter publication.

    If the latter is the case you could create different fields in Pagesetter for different languages. For instance title_en_US and content_en_US or title_es_ES and content_es_ES. In your template you could then retrieve the current language, and on the bases of that language decide to which field to show. You would get something like this:

    Code

    <!--[pnusergetlang name="userlang"]-->
    <!--[if $userlang == "es_ES"]-->
      <h1><!--[$title_es_ES]--></h1>
      <div><!--[$content_es_ES]--></div>
    <!--[else]-->
      <h1><!--[$title_en_US]--></h1>
      <div><!--[$content_en_US]--></div>
    <!--[/if]-->

    If what you want is displaying a form for a user to submit content you could use the pgForm module and apply the same kind of logic as described above.

    Alternatively you could consider moving your content to the Content module which supports different languages linked to one publication (including translation interface) out of the box.
  • Thank you for your help, your code did not work at once, it just printed out the language code, but I browsed the internet again and again and finally I found the solution

    A very small change

    Code

    <!--[pnusergetlang assign="userlang"]-->


    By the way I'd like to learn as much as possible, I wonder I there is a kind of hanbook or similar.
    Thank You



    Edited by peristrema on Jan 07, 2011 - 08:14 AM.

This list is based on users active over the last 60 minutes.