rejetto forum

userparam's and %lang%

bacter · 8 · 4477

0 Members and 1 Guest are viewing this topic.

Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
The language feature may be very interesting, but:
1. I think it will be difficult to get the language from browser info or based on the ip.
2. not everybody who uses hfs may use or understand more than one language, and even if they do, it's likely that guests with other languages connect to the site, and it would be useless to have lang-value for a language not supported.
Conclusion: In order to simplify the implementation of %lang% and it's use, I propose to make it user-selectable in the template with a method that somebody posted in this forum for other uses:
the method would be a link for each language supported by the site to the same page, adding a param.

example:   http://miserverip:port/?lang=it

Rejetto's work would be, where the logstring for requesterd gets is generated, to strip off what's coming after the '?' sign, check, if its 'lang' and put the value 'it' or whatever the href sends, into the %lang% variable asociated to the user, where the value remains during the session.
This involves to have bigger storage structure for each conected user, where until now there was only (I suppose, because I didn't view the source code..) a pair of values: username, userip.

By that way, I suggest also to add to more params like lang, that may be named 'upar1', 'upar2' and these values could be associated in the same way als ?lang=____. I want to use this params to select different styles, so that the user can select between different letter-size depending on it's screen, or to select fast-display-template with minimal graphic overhead instead of full presentation, depending on its conection (slow modem or LAN). Perhaps other users faind additional aplications for this.

If You go on working on that new user-structure, think also in adding a field for 'memberofgroups', that would be necessary to implement user-groups in the manner I will propose in a separate thread.

In a later future we could also think to leave these values in the user-account-management.
your computer has no brain - use your own !


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2053
    • View Profile

If you want to create a site multilanguage this is very simply made without %lang% and the other subtleties

uses folders for different languages

English , Fran├žais , Deutch .......     or links to this hide folders  (with gif logos to differenciate)

into hfs root template put a special page with no login , only links or folders with explain to users how they can do.

and into every folder put your principal template hfs.diff.tpl tranlate in every language this will be recurssive for each subfolders into "folder-lang"




Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
mars:

your workaround implies multiplicating the same folders , and very ugly navigation through the filesystem.

The 'subtleties' of persistent user values (lang, upar..) could also be useful for other things, like the multipagedisplay of folders as requested and treated in some posts.
your computer has no brain - use your own !


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2053
    • View Profile
another way

include  this in the "main" section    [[ %sym-%user%%  ]]    somewhere

and include  sections for differents users like:

[sym-Marcel]
votre langue est le fran├žais

[sym-Bob]
how do you do?

[sym-~Rejetto]
buongiorno amico Rejetto


don't add this section  [sym-] until rejetto modify code to affect by default %user%="~" and after use :

[sym-~]
You are not logged

Connect you under the various identifiers and see the resultat.



to how use this astuce refer you to template "Thunderchicken_of_Glory_Blue+Login.tpl"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "h t t p://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <title>****YOUR TITLE****: %folder%</title>
.
.
.
</head>

<body>
%login-link%
%loggedin%
</body>
</html>


[login-link]
 

 here you put your first web page into multilanguage like  this link  http://strassburg.ath.cx:4136/

[loggedin]
%sym-%user%%

[style]
.
.
.

[sym-user1]
   include "main template for user 1
.
.
.

[sym-usern]
   include "main template for user n"







Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
dear mars:

Your second proposal to avoid the need for user related variables is even worse than the first! Do you really mean that it's clever to have a list off all users in a template? :)
Your proposal may be a horrible way to avoid the 'per-user-diff-template' which appears in some post's, but can't  in no way be usefull to implement different languages!

Even with the section aliasing [sym-mars = sym-claudine = sym-denise] Comment vas tu ? ... your proposal would not be better.

Besides, there is no need for a '~' for a default user , you can do the same with a void user - but hfs needs to handle it correctly!

This type of 'simple solutions' where of the type that I first desestimated when I searched a way for multilingual templates, until I came to the conclusion that there is no way to have a clean form to implement it without  a persistent per-user-value for the whole conection or retrievable in any form. This value also must be in a set we want it to be, one based on the origin of ip dont work! I must let the user select between de-en-es-fr-it for example, I can't make templates or helptexts in ru,jp,co ... ;)
your computer has no brain - use your own !


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2053
    • View Profile
If you consider in the former post you will find some questions there concerning the possible addition de %lang%, and the answers of rejetto that the question cannot be resolved that in version 3.x to see 4.x of hfs and not before some years can be.

By waiting we shall have to content ourselves with some available solutions which allows us hfs.

Concerning my two examples:

The first one bases himself on a template of reception which redirects towards the language which the user wishes, kicks out to manage because it implies the use of as much of hfs.diff.tpl as necessary directories. Only some users are broken in the constraints that is the multiple use of templates.

The second is can be not for you the best of the solutions but it will bring to some an opening of spirit on the fact that hfs hide within it full of resources and that if we know how to play finely with them we can make extraordinary things.
I invite you to load the sources of hfs as I made him and study them to learn it much more on its functioning.

The use of hfs for a system multilanguage involves in your case a management of the users and thus the use of a more powerful data base what is not still of current events in the development of hfs (we cannot build a solid high rise if on the base the ground is unstable), to develop hfs it is necessary to correct some bugs or forgetting before dashing into big transformations.

Certain bugs as the interweaving of [sym-mysection] and of %user% should not work but it brings a little of simplicity because it is not possible to use any if-then-else  to select a particular section by its variable %sym-mysection% according to a specific user (%user%)  who here is used as reference criterion.

As if to defining %user% ="~" or another character by default explains by the simple fact that if the user is not identified %sym-%user%%  becomes %sym-% in the display. And that if we created a section [sym-] for which are taken into account and replace staying %sym-%, then it appears another bug which is that hfs look for at first to replace %sym-% by the corresponding section [sym-]: not finding she, he replaces %user% by his value and the text becomes for example %sym-myident% (%user%="myident") which corresponds then to the section [sym-myident], and the tour(ballot) is played.

In case you use %sym-%user%% and a section [sym-] in association with the others of the type [sym-myident], then the other sections shall never appear, I tried it does not work as we could hope for it, thus my demand of %user%= "~"" is completely justified and I do not have to defend  myself from it.




Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
mars:

Naturally you dont need te defend you for anything you propose. I regret if my comments sounded to you as an attack or someting like that - that's not my intention.

HFS is a fine program and a fine project. We may wait until rejetto fulfills dreams, but as long as we are not helping him with code, the function of this forum is also discuss possible 'future' features, and posible forms how to implement them and to use them. So other users may contribute with critics or arguments to develop the ideas. This facilitates the analisis to find a good solution.

Naturally there may be some work-arounds for some situations, until hfs will support some special features (subtleties). But I think the exposed 'solutions' (all evaluated, including the behaviour of %user% and %sym-something%user%%, before rejecting them!) are most feasable to 4-folder-systems or 12-users-3-languages-systems, and to do this, i want no work-around , it's not worth to spend time on that.

So I think we can close this section until somebody finds better solutions. I already begun tu study the source code, but as I'm sure you know, reading at moments on spare-time someone elses code is not easy, as you have to get the structure of the whole thing, not only some procedures.

Ad I repeat - you don't need to justify anything. We have simply different point's of view how to do or not to do things, that' s all.
your computer has no brain - use your own !


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2053
    • View Profile
i have found a simply solution for you

http://www.commentcamarche.net/javascript/jsintro.php3

http://www.toutjavascript.com/reference/reference.php?

use this part of code

<SCRIPT language=javascript>
   document.write(navigator.userLanguage);
</SCRIPT>

you can see the result FR ,  IT  , EN  .... if your navigator is in french italian english .....

and use the result with apropriate section of your choice or redirect to a folder with a template in fr it en ...


so no need to stock the language of a user into database of users.
 :) ;) :D ;D
« Last Edit: October 10, 2007, 01:05:15 AM by mars »