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
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- craigh responded to »Using PageUtil::addVar() to load script code« 03:29 PM
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Language in a form (Pagesetter)
-
- Rank: Registered User
- Registered: Jan 15, 2006
- Last visit: Dec 09, 2009
- Posts: 32
-
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1967
-
- Rank: Registered User
- Registered: Jan 15, 2006
- Last visit: Dec 09, 2009
- Posts: 32
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 -
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1967
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(); -
- Rank: Registered User
- Registered: Jan 15, 2006
- Last visit: Dec 09, 2009
- Posts: 32
It is a Pagesetter template
I've found thatin a template gives me the language selected by the user, I want something like thatCode
<!--[lang]-->
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. -
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1967
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. -
- Rank: Developer
- Registered: Feb 17, 2005
- Last visit: May 21, 2010
- Posts: 684
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. -
- Rank: Registered User
- Registered: Jan 15, 2006
- Last visit: Dec 09, 2009
- Posts: 32
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.
- Moderated by:
- Support
