lang and getstring error

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

lang and getstring error

stevepiercy
I updated an older version of Knop to the latest in the repo,
and now I'm getting these errors:

-9948: No tag, type or constant was defined under the name
pair->replace with arguments: array: (#1#), ()
  at: getstring with params: -key='authfailed', -language=@'', -replace=@''

The change notes indicate:

2010-05-27  JS  getstring now works also with empty -replace value
2010-04-20  JS  getstring debug output corrected for missing string.

And I'm trying to use this language string:

     'authfailed'=pair('fatal'='Authentication failed.'),

I'm looking into how to fix this, but does anyone have a quick
fix suggestion?

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

stevepiercy
It looks like this change in lang.inc borked it:

Original:
            if: #output -> size && (local_defined: 'replace') && #replace -> size;

Latest:
            if: #output -> size && (local_defined: 'replace'); // && #replace -> size;

I'm not really clear why this change was needed.  Johan?

The quick fix is to change the pair in my language strings to just a string.

     'authfailed'='Authentication failed.',
//     'authfailed'=pair('fatal'='Authentication failed.'),

--steve


On 12/28/10 at 2:40 PM, [hidden email] (Steve Piercy - Web Site Builder) pronounced:

> I updated an older version of Knop to the latest in the repo, and now I'm getting
> these errors:
>
> -9948: No tag, type or constant was defined under the name pair->replace with
> arguments: array: (#1#), ()
>  at: getstring with params: -key='authfailed', -language=@'', -replace=@''
>
> The change notes indicate:
>
> 2010-05-27  JS  getstring now works also with empty -replace value
> 2010-04-20  JS  getstring debug output corrected for missing string.
>
> And I'm trying to use this language string:
>
>     'authfailed'=pair('fatal'='Authentication failed.'),
>
> I'm looking into how to fix this, but does anyone have a quick fix suggestion?
>
> --steve
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy               Web Site Builder               Soquel, CA
> <[hidden email]>                  <http://www.StevePiercy.com/>
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

Johan Solve-2
At 15.17 -0800 2010-12-28, Steve Piercy - Web Site Builder wrote:
>It looks like this change in lang.inc borked it:
>
>Original:
>            if: #output -> size && (local_defined: 'replace') && #replace -> size;
>
>Latest:
>            if: #output -> size && (local_defined: 'replace'); // && #replace -> size;
>
>I'm not really clear why this change was needed.  Johan?

To not leave #1# behind in the string if the replacement was empty.

>The quick fix is to change the pair in my language strings to just a string.
>
>     'authfailed'='Authentication failed.',
>//     'authfailed'=pair('fatal'='Authentication failed.'),

I'm not sure if language strings were supposed to be anything other than strings, but of course it can be made to work so that only strings will get the replace treatment.

Here you got, this should do it (same line):
if(#output -> size && #output -> isa('string') && (local_defined: 'replace'));


--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[hidden email]
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

Johan Solve-2
At 10.42 +0100 2010-12-29, Johan Solve wrote:

>At 15.17 -0800 2010-12-28, Steve Piercy - Web Site Builder wrote:
>>It looks like this change in lang.inc borked it:
>>
>>Original:
>>            if: #output -> size && (local_defined: 'replace') && #replace -> size;
>>
>>Latest:
>>            if: #output -> size && (local_defined: 'replace'); // && #replace -> size;
>>
>>I'm not really clear why this change was needed.  Johan?
>
>To not leave #1# behind in the string if the replacement was empty.
>
>>The quick fix is to change the pair in my language strings to just a string.
>>
>>     'authfailed'='Authentication failed.',
>>//     'authfailed'=pair('fatal'='Authentication failed.'),
>
>I'm not sure if language strings were supposed to be anything other than strings, but of course it can be made to work so that only strings will get the replace treatment.
>
>Here you got, this should do it (same line):
>if(#output -> size && #output -> isa('string') && (local_defined: 'replace'));

I've commited this change to the trunk

--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[hidden email]
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

stevepiercy
On 12/29/10 at 10:47 AM, [hidden email] (Johan Solve) pronounced:

>>>The quick fix is to change the pair in my language strings to just a string.
>>>
>>>     'authfailed'='Authentication failed.',
>>>//     'authfailed'=pair('fatal'='Authentication failed.'),
>>
>>I'm not sure if language strings were supposed to be anything
>>other than strings, but of course it can be made to work so
>>that only strings will get the replace treatment.

They weren't.  But if pairs are allowed, then one can manipulate
the output when displaying validation or other form errors inline.

Example:
// show error message...
if($message->size);
     // ... as a result of login form submission
     '<p class="message">';
     iterate($message, local('m'));
         loop_count > 1 ? '<br>\n';
         if(#m -> type == 'pair');
         // if message item is a pair, the left side of the pair
is a class name to use to format this message text
             '<span class="' + (#m -> name) + '">' + (#m ->
value) + '</span>';
         else;
             #m;
         /if;
     /iterate;
     '</p>';
...

Refer to:
http://old.nabble.com/Re%3A-Display-validation-error-messages-next-to-each-field--p24184440.html

>>Here you got, this should do it (same line):
>>if(#output -> size && #output -> isa('string') && (local_defined: 'replace'));
>
>I've commited this change to the trunk

Thanks!  Tested and works beautifully.  The lang string
"Authentication failed." now gets styled by the class 'fatal' to
appear in upper case and colored a friendly red.

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

list
29 dec 2010 kl. 12.49 skrev Steve Piercy - Web Site Builder:

> On 12/29/10 at 10:47 AM, [hidden email] (Johan Solve) pronounced:
>
>>>> The quick fix is to change the pair in my language strings to just a string.
>>>>
>>>>    'authfailed'='Authentication failed.',
>>>> //     'authfailed'=pair('fatal'='Authentication failed.'),
>>>
>>> I'm not sure if language strings were supposed to be anything other than strings, but of course it can be made to work so that only strings will get the replace treatment.
>
> They weren't.  But if pairs are allowed, then one can manipulate the output when displaying validation or other form errors inline.
>
> Example:
> // show error message...
> if($message->size);
>    // ... as a result of login form submission
>    '<p class="message">';
>    iterate($message, local('m'));
>        loop_count > 1 ? '<br>\n';
>        if(#m -> type == 'pair');
>        // if message item is a pair, the left side of the pair is a class name to use to format this message text
>            '<span class="' + (#m -> name) + '">' + (#m -> value) + '</span>';
>        else;
>            #m;
>        /if;
>    /iterate;
>    '</p>';

I do the exact same thing. Although I have it in a tag. But I fail to see why the language string need to be a pair. The class will stay the same regardless of language. When building the message array I provide class depending of what type of message to display and then for the value of the pair do a lookup in the language module. There can be a lot of situations where I'd want the language string by itself without any class attached to it and the same string can be used for different classes.

HDB
Jolle
--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

stevepiercy
On 12/29/10 at 12:58 PM, [hidden email] pronounced:

>29 dec 2010 kl. 12.49 skrev Steve Piercy - Web Site Builder:
>
>>On 12/29/10 at 10:47 AM, [hidden email] (Johan Solve) pronounced:
>>
>>>>> The quick fix is to change the pair in my language strings to just a string.
>>>>>      'authfailed'='Authentication failed.',
>>>>> //     'authfailed'=pair('fatal'='Authentication failed.'),
>>>>   I'm not sure if language strings were supposed to be
>>>>anything other than strings,
>but of course it can be made to work so that only strings will
>get the replace treatment.
>>
>>They weren't.  But if pairs are allowed, then one can manipulate the output when
>displaying validation or other form errors inline.
>>
>>Example:
>>// show error message...
>>if($message->size);
>>// ... as a result of login form submission
>>'<p class="message">';
>>iterate($message, local('m'));
>>loop_count > 1 ? '<br>\n';
>>if(#m -> type == 'pair');
>>// if message item is a pair, the left side of the pair is a class name to
>use to format this message text
>>'<span class="' + (#m -> name) + '">' + (#m -> value) + '</span>';
>>else;
>>#m;
>>/if;
>>/iterate;
>>'</p>';
>
>I do the exact same thing. Although I have it in a tag. But I
>fail to see why the language string need to be a pair. The
>class will stay the same regardless of language. When building
>the message array I provide class depending of what type of
>message to display and then for the value of the pair do a
>lookup in the language module. There can be a lot of situations
>where I'd want the language string by itself without any class
>attached to it and the same string can be used for different classes.

How do you build your message array and provide the class?  If
there is a better way to style an error message (or language
string in general), then I'm all eyes.

Pairs are not required, but it works for me and the client in
this specific situation.

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

list
29 dec 2010 kl. 13.15 skrev Steve Piercy - Web Site Builder:

> On 12/29/10 at 12:58 PM, [hidden email] pronounced:
>
>> 29 dec 2010 kl. 12.49 skrev Steve Piercy - Web Site Builder:
>>
>>> On 12/29/10 at 10:47 AM, [hidden email] (Johan Solve) pronounced:
>>>
>>>>>> The quick fix is to change the pair in my language strings to just a string.
>>>>>>     'authfailed'='Authentication failed.',
>>>>>> //     'authfailed'=pair('fatal'='Authentication failed.'),
>>>>>  I'm not sure if language strings were supposed to be anything other than strings,
>> but of course it can be made to work so that only strings will get the replace treatment.
>>>
>>> They weren't.  But if pairs are allowed, then one can manipulate the output when
>> displaying validation or other form errors inline.
>>>
>>> Example:
>>> // show error message...
>>> if($message->size);
>>> // ... as a result of login form submission
>>> '<p class="message">';
>>> iterate($message, local('m'));
>>> loop_count > 1 ? '<br>\n';
>>> if(#m -> type == 'pair');
>>> // if message item is a pair, the left side of the pair is a class name to
>> use to format this message text
>>> '<span class="' + (#m -> name) + '">' + (#m -> value) + '</span>';
>>> else;
>>> #m;
>>> /if;
>>> /iterate;
>>> '</p>';
>>
>> I do the exact same thing. Although I have it in a tag. But I fail to see why the language string need to be a pair. The class will stay the same regardless of language. When building the message array I provide class depending of what type of message to display and then for the value of the pair do a lookup in the language module. There can be a lot of situations where I'd want the language string by itself without any class attached to it and the same string can be used for different classes.
>
> How do you build your message array and provide the class?  If there is a better way to style an error message (or language string in general), then I'm all eyes.
>
> Pairs are not required, but it works for me and the client in this specific situation.

As one of my default vars I create a message array in the site config.

Anywhere I then want a message displayed I send the message string to the array. If I want it displayed with a specific class, mostly error messages, I send it as a pair with the class as the name and the message string as the value.
Some examples:

// If there's an error in the process code:
$fForm -> error_code ? ($message -> insert( 'error' = ($lang_errormessages -> getstring( ('code' + ($fForm -> error_code))))));

$dBase -> error_code ? $message -> insert( 'error' = 'DB: ' + ($lang_errormessages -> getstring( ('code' + ($dBase -> error_code)))) + ' ' + ($dBase -> error_code));

// for messages in no need of a class:
$message -> insert( ($lang -> recRegistred));

I would prefer to not have classes hard corded to language strings as these can be used in a variety of circumstances and with different styling needs.

On content page I treat the message array the same you do, if it's a pair then use name as class.

HDB
Jolle
--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

stevepiercy
On 12/29/10 at 1:45 PM, [hidden email] pronounced:

>29 dec 2010 kl. 13.15 skrev Steve Piercy - Web Site Builder:
>
>>On 12/29/10 at 12:58 PM, [hidden email] pronounced:
>>
>>> 29 dec 2010 kl. 12.49 skrev Steve Piercy - Web Site Builder:
>>>
>>>> On 12/29/10 at 10:47 AM, [hidden email] (Johan Solve) pronounced:
>>>>
>>>>>>> The quick fix is to change the pair in my language strings to just a string.
>>>>>>>     'authfailed'='Authentication failed.',
>>>>>>> //     'authfailed'=pair('fatal'='Authentication failed.'),
>>>>>>  I'm not sure if language strings were supposed to be anything other than
>strings,
>>> but of course it can be made to work so that only strings will get the replace
>treatment.
>>>>   They weren't.  But if pairs are allowed, then one can
>>>>manipulate the output when
>>> displaying validation or other form errors inline.
>>>>   Example:
>>>> // show error message...
>>>> if($message->size);
>>>> // ... as a result of login form submission
>>>> '<p class="message">';
>>>> iterate($message, local('m'));
>>>> loop_count > 1 ? '<br>\n';
>>>> if(#m -> type == 'pair');
>>>> // if message item is a pair, the left side of the pair is a class name to
>>> use to format this message text
>>>> '<span class="' + (#m -> name) + '">' + (#m -> value) + '</span>';
>>>> else;
>>>> #m;
>>>> /if;
>>>> /iterate;
>>>> '</p>';
>>>   I do the exact same thing. Although I have it in a tag.
>>>But I fail to see why the
>language string need to be a pair. The class will stay the same
>regardless of language. When building the message array I
>provide class depending of what type of message to display and
>then for the value of the pair do a lookup in the language
>module. There can be a lot of situations where I'd want the
>language string by itself without any class attached to it and
>the same string can be used for different classes.
>>
>>How do you build your message array and provide the class?  If there is a better way
>to style an error message (or language string in general), then I'm all eyes.
>>
>>Pairs are not required, but it works for me and the client in this specific
>situation.
>
>As one of my default vars I create a message array in the site config.
>
>Anywhere I then want a message displayed I send the message
>string to the array. If I want it displayed with a specific
>class, mostly error messages, I send it as a pair with the
>class as the name and the message string as the value.
>Some examples:
>
>// If there's an error in the process code:
>$fForm -> error_code ? ($message -> insert( 'error' =
>($lang_errormessages -> getstring( ('code' + ($fForm -> error_code))))));
>
>$dBase -> error_code ? $message -> insert( 'error' = 'DB: ' +
>($lang_errormessages -> getstring( ('code' + ($dBase ->
>error_code)))) + ' ' + ($dBase -> error_code));
>
>// for messages in no need of a class:
>$message -> insert( ($lang -> recRegistred));
>
>I would prefer to not have classes hard corded to language
>strings as these can be used in a variety of circumstances and
>with different styling needs.
>
>On content page I treat the message array the same you do, if
>it's a pair then use name as class.

So in the above first two examples, is the style named "error"?

I honestly cannot remember why I did it the way I did.  99% of
my language keys have strings for values.  Maybe it had
something to do with my custom validation and wanting to bind
the error message to a specific field instead of the form.

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

list
29 dec 2010 kl. 14.17 skrev Steve Piercy - Web Site Builder:

> So in the above first two examples, is the style named "error"?

Yes.

HDB
Jolle

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

Johan Solve-2
In reply to this post by list
At 12.58 +0100 2010-12-29, [hidden email] wrote:

>29 dec 2010 kl. 12.49 skrev Steve Piercy - Web Site Builder:
>
>> On 12/29/10 at 10:47 AM, [hidden email] (Johan Solve) pronounced:
>>
>>>>> The quick fix is to change the pair in my language strings to just a string.
>>>>>
>>>>>    'authfailed'='Authentication failed.',
>>>>> //     'authfailed'=pair('fatal'='Authentication failed.'),
>>>>
>>>> I'm not sure if language strings were supposed to be anything other than strings, but of course it can be made to work so that only strings will get the replace treatment.
>>
>> They weren't.  But if pairs are allowed, then one can manipulate the output when displaying validation or other form errors inline.
>>
>> Example:
>> // show error message...
>> if($message->size);
>>    // ... as a result of login form submission
>>    '<p class="message">';
>>    iterate($message, local('m'));
>>        loop_count > 1 ? '<br>\n';
>>        if(#m -> type == 'pair');
>>        // if message item is a pair, the left side of the pair is a class name to use to format this message text
>>            '<span class="' + (#m -> name) + '">' + (#m -> value) + '</span>';
>>        else;
>>            #m;
>>        /if;
>>    /iterate;
>>    '</p>';
>
>I do the exact same thing. Although I have it in a tag. But I fail to see why the language string need to be a pair. The class will stay the same regardless of language. When building the message array I provide class depending of what type of message to display and then for the value of the pair do a lookup in the language module. There can be a lot of situations where I'd want the language string by itself without any class attached to it and the same string can be used for different classes.

Hmm, me too... The class=message thing in a message array. Do we have the same source perhaps? Otherwise it would almost be spooky. I don't remember where I got the idea.
Oh yea, it's in the Knop demo, but not as ctag.


define_tag('showmessage', -required='messagearray', -optional='class',
        -priority='replace');
        local('output'=string);
        !local_defined('class') ? local('class'='message');

        if(#messagearray -> size);
                #output += '<p class="' + #class + '">\n';
                iterate(#messagearray, (local('messageitem')));
                        loop_count > 1 ? #output+= '<br>\n';
                        if(#messageitem -> type == 'pair');
                                // if message item is a pair, first item is the class name
                                #messageitem = ('<span class="' + (#messageitem -> name) + '">' + (#messageitem -> value) + '</span>');
                        /if;
                        #output += #messageitem + '\n';
                /iterate;
                #output += '</p>\n';
                // clear the message array
                #messagearray = array;
                return(@#output);
        /if;
/define_tag;



--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[hidden email]
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: lang and getstring error

Johan Solve-2
Eh, that wasn't from the knop demo code, it was a reincarnation as a ctag...

At 15.51 +0100 2010-12-29, Johan Solve wrote:

>At 12.58 +0100 2010-12-29, [hidden email] wrote:
>>29 dec 2010 kl. 12.49 skrev Steve Piercy - Web Site Builder:
>>
>>> On 12/29/10 at 10:47 AM, [hidden email] (Johan Solve) pronounced:
>>>
>>>>>> The quick fix is to change the pair in my language strings to just a string.
>>>>>>
>>>>>>    'authfailed'='Authentication failed.',
>>>>>> //     'authfailed'=pair('fatal'='Authentication failed.'),
>>>>>
>>>>> I'm not sure if language strings were supposed to be anything other than strings, but of course it can be made to work so that only strings will get the replace treatment.
>>>
>>> They weren't.  But if pairs are allowed, then one can manipulate the output when displaying validation or other form errors inline.
>>>
>>> Example:
>>> // show error message...
>>> if($message->size);
>>>    // ... as a result of login form submission
>>>    '<p class="message">';
>>>    iterate($message, local('m'));
>>>        loop_count > 1 ? '<br>\n';
>>>        if(#m -> type == 'pair');
>>>        // if message item is a pair, the left side of the pair is a class name to use to format this message text
>>>            '<span class="' + (#m -> name) + '">' + (#m -> value) + '</span>';
>>>        else;
>>>            #m;
>>>        /if;
>>>    /iterate;
>>>    '</p>';
>>
>>I do the exact same thing. Although I have it in a tag. But I fail to see why the language string need to be a pair. The class will stay the same regardless of language. When building the message array I provide class depending of what type of message to display and then for the value of the pair do a lookup in the language module. There can be a lot of situations where I'd want the language string by itself without any class attached to it and the same string can be used for different classes.
>
>Hmm, me too... The class=message thing in a message array. Do we have the same source perhaps? Otherwise it would almost be spooky. I don't remember where I got the idea.
>Oh yea, it's in the Knop demo, but not as ctag.
>
>
>define_tag('showmessage', -required='messagearray', -optional='class',
> -priority='replace');
> local('output'=string);
> !local_defined('class') ? local('class'='message');
>
> if(#messagearray -> size);
> #output += '<p class="' + #class + '">\n';
> iterate(#messagearray, (local('messageitem')));
> loop_count > 1 ? #output+= '<br>\n';
> if(#messageitem -> type == 'pair');
> // if message item is a pair, first item is the class name
> #messageitem = ('<span class="' + (#messageitem -> name) + '">' + (#messageitem -> value) + '</span>');
> /if;
> #output += #messageitem + '\n';
> /iterate;
> #output += '</p>\n';
> // clear the message array
> #messagearray = array;
> return(@#output);
> /if;
>/define_tag;
>
>
>
>--
>     Johan Sölve    [FSA Member, Lasso Partner]
>     Web Application/Lasso/FileMaker Developer
>     MONTANIA SOFTWARE & SOLUTIONS
>http://www.montania.se   mailto:[hidden email]
> (spam-safe email address, replace '-' with 'a')
>
>--
>#############################################################
>This message is sent to you because you are subscribed to
>the mailing list <[hidden email]>.
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>
>List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
>Project homepage http://montania.se/projects/knop/
>Google Code has the latest downloads at http://code.google.com/p/knop/


--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[hidden email]
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/