Making good use of the lang type

View: New views
16 Messages — Rating Filter:   Alert me  

Making good use of the lang type

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here's a little sunshine story from the world of Knop.

Since Johan provided the lang ctype I've moved all language strings  
into a cfg.language.inc file. It's been a tedious operation since it's  
a fairly large project and a lot of files to check out. It's amazing  
how many places one tend to put small pieces of language bits. But  
once I had all of these bits collected I could start making use of it.  
By changing a config setting I could easily switch between Swedish and  
English. Worked like a charm but it still required a hardwired setting  
to be changed by me.
So I decided that it was time to let the individual users change it  
for themselves.

I stole an english/american flag from the net and constructed a  
Swedish one by myself. Put them in a div with a link in the site  
template. Created a cookie to hold the language value and a tiny bit  
of code to change the setting and Voila! A convenient way for the user  
to change language for the entire site accesible on every page of the  
site. It worked without any alterations directly and it took me less  
than an hour to complete, flag stealing and all. I like that!

HDB
Jolle

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Steve Piercy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday, May 16, 2008, jolle@... (Jolle Carlestam) pronounced:

>I stole an english/american flag from the net and constructed a  
>Swedish one by myself.

For when you get around to a Canadian translation:
http://famfamfam.com/lab/icons/flags/

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<web@...>                  <http://www.StevePiercy.com/>

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

16 maj 2008 kl. 10.59 skrev Steve Piercy - Web Site Builder:

>
> On Friday, May 16, 2008, jolle@... (Jolle Carlestam)  
> pronounced:
>
>> I stole an english/american flag from the net and constructed a
>> Swedish one by myself.
>
> For when you get around to a Canadian translation:
> http://famfamfam.com/lab/icons/flags/

Canadian. Hm. You get me thinking. I thought it was a good idea to  
have a flag that's half British and half US. I've hesitated using  
British flag since English is used in the States as well. Now you  
remind me that English is official language is so many other countries  
as well. Should I have a flag symbol that represents all of these  
countries...? It would have to be fairly big.

But how do Canadians doo? What flag do they show to indicate that you  
can change between French and English. And how do they do in South  
Africa where they have 12 official languages?!

Nah, the project just got too big. I'll leave it with the flags I have  
and decide the rest when I have a client demanding a solution.

But back to the beauty of Knop lang. Should I get a french client all  
I need to do is have someone translate one language document, find a  
flag and add french as an accepted language. Then I can deliver a  
complete french application without changing any code! I like that!

HDB
Jolle

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Steve Piercy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday, May 16, 2008, jolle@... (Jolle Carlestam) pronounced:

>Canadian. Hm. You get me thinking. I thought it was a good idea to  
>have a flag that's half British and half US. I've hesitated using  
>British flag since English is used in the States as well. Now you  
>remind me that English is official language is so many other countries  
>as well. Should I have a flag symbol that represents all of these  
>countries...? It would have to be fairly big.

There are minor differences between American and Great Britain English, mostly with spelling of words and a few dialectics.  "center" in US, "centre" in GB (and the rest of the world, I think).  color/colour.  exit/way out.

On another level, Americans, Canadians and other English-speaking folks may have slightly different perspectives on the meaning of icons.  To be honest, I find the link "English" to be much more useful than a bunch of flags.

>But how do Canadians doo?

Usually by squatting, just like the rest of us.  At least their restrooms look similar to those in the US, but I can't really say since I've never witnessed Canadians exhibit this behavior.

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<web@...>                  <http://www.StevePiercy.com/>

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Göran Törnquist-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 11.39 +0200 08-05-16, Jolle Carlestam wrote:
>But back to the beauty of Knop lang. Should I
>get a french client all I need to do is have
>someone translate one language document, find a
>flag and add french as an accepted language.
>Then I can deliver a complete french application
>without changing any code! I like that!

You wish! The other country might have a
different currency, date format, holidays (which
may or may not affect your applicatiion),
regulations concerning encryption, private data
etc.

You will have a good starting point, but...it's
not really that easy once you've been through it.
:-)

/Göran
--
-----------------
Göran Törnquist
Stockby Hantverksby 4
181 75 Lidingö

0733-86 04 70

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 12.24 +0200 2008-05-16, Göran Törnquist wrote:
>At 11.39 +0200 08-05-16, Jolle Carlestam wrote:
>>But back to the beauty of Knop lang. Should I get a french client all I need to do is have someone translate one language document, find a flag and add french as an accepted language. Then I can deliver a complete french application without changing any code! I like that!
>
>You wish! The other country might have a different currency, date format, holidays (which may or may not affect your applicatiion), regulations concerning encryption, private data etc.
>
>You will have a good starting point, but...it's not really that easy once you've been through it. :-)

At least knop_lang supports compound expressions so you can format dates etc accordingly. And on the todo list I also have this:
"Provide methods to handle formatting of dates, numbers, currency etc for different languages/locales. Weekday names, month names etc. "

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

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

16 maj 2008 kl. 12.24 skrev Göran Törnquist:

>
> At 11.39 +0200 08-05-16, Jolle Carlestam wrote:
>> But back to the beauty of Knop lang. Should I get a french client  
>> all I need to do is have someone translate one language document,  
>> find a flag and add french as an accepted language. Then I can  
>> deliver a complete french application without changing any code! I  
>> like that!
>
> You wish! The other country might have a different currency, date  
> format, holidays (which may or may not affect your applicatiion),  
> regulations concerning encryption, private data etc.
>
> You will have a good starting point, but...it's not really that easy  
> once you've been through it. :-)

Good points most of it.

I have two items I wouldn't have to care about.

Dates -> I've taken an oath that I will never ever do anything with  
dates that's not ISO standard. So no matter where I deliver my stuff  
the dates stay the same. It's that way now. Should an Englishman or  
American care to use my stuff then they would have to accept that  
dates are according to international standards. They can get the stuff  
in English, no problem, but dates... No way.

Holidays -> As it so happens I have a Holiday table incorporated into  
my solution so it's just for whomever admins the application to insert  
their own holidays. And what starts a week (monday/sunday) is a config  
setting too.

But the rest of it. So true. Then on the other hand that's good too.  
Means I can charge more for localisation. :-)

HDB
Jolle
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Nikolaj de Fine Licht :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 16. maj 2008, at 10:09, Jolle Carlestam wrote:

> Since Johan provided the lang ctype I've moved all language strings  
> into a cfg.language.inc file. It's been a tedious operation since  
> it's a fairly large project and a lot of files to check out. It's  
> amazing how many places one tend to put small pieces of language  
> bits. But once I had all of these bits collected I could start  
> making use of it. By changing a config setting I could easily switch  
> between Swedish and English.

I'm almost done with the translation into Danish, Jolle. I guess you  
have added many new things since, you must merge with what I send you  
soon and then give me the rest to translate.

BTW, why do you use "sv" for the Swedish language code and not the  
official "se"?

/nikolaj

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

16 maj 2008 kl. 14.22 skrev Nikolaj de Fine Licht:

>
> On 16. maj 2008, at 10:09, Jolle Carlestam wrote:
>
>> Since Johan provided the lang ctype I've moved all language strings  
>> into a cfg.language.inc file. It's been a tedious operation since  
>> it's a fairly large project and a lot of files to check out. It's  
>> amazing how many places one tend to put small pieces of language  
>> bits. But once I had all of these bits collected I could start  
>> making use of it. By changing a config setting I could easily  
>> switch between Swedish and English.
>
> I'm almost done with the translation into Danish, Jolle.

Sounds great!!!

> BTW, why do you use "sv" for the Swedish language code and not the  
> official "se"?

Because I got a slap on the wrist from, I think, Bil. He told me that  
se is the code for Sweden but sv is the code for Swedish. And this  
does make a difference cause not only do we have several languages in  
Sweden, Swedish is also the official language for at least on other  
country, Finland.

http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

Danish is by the way da with dk for Denmark. Just so you know. :-)

HDB
Jolle

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by bilcorry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jolle Carlestam wrote on 5/16/2008 7:44 AM:
> 16 maj 2008 kl. 14.22 skrev Nikolaj de Fine Licht:
>> BTW, why do you use "sv" for the Swedish language code and not the
>> official "se"?
>
> Because I got a slap on the wrist from, I think, Bil. He told me that se
> is the code for Sweden but sv is the code for Swedish.

It was a gentle slap :)


- Bil


#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by bilcorry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johan Solve wrote on 5/16/2008 6:27 AM:
> And on the todo list I also have this: "Provide methods to handle
> formatting of dates, numbers, currency etc for different
> languages/locales. Weekday names, month names etc. "

Java has a lot of this locale information built-in.  For example, my [dateTime] type uses locale from Java to return the proper names for days, months, etc.  So you could conceivably use a LJAPI tag to grab locale information and at least pre-populate the defaults, then allow the developer to override.

And Jolle might consider using the Accept-Language header to pre-populate the default language choice.  I know you (Johan) were playing with it at one point.  Did you ever get the code working?


- Bil


#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

16 maj 2008 kl. 15.23 skrev Bil Corry:

>
> Jolle Carlestam wrote on 5/16/2008 7:44 AM:
>> 16 maj 2008 kl. 14.22 skrev Nikolaj de Fine Licht:
>>> BTW, why do you use "sv" for the Swedish language code and not the  
>>> official "se"?
>> Because I got a slap on the wrist from, I think, Bil. He told me  
>> that se is the code for Sweden but sv is the code for Swedish.
>
> It was a gentle slap :)

Oh yes, Doctor says I can probably use the hand again this winter.
Maybe not all the fingers...
:-)

HDB
Jolle

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

16 maj 2008 kl. 15.29 skrev Bil Corry:

> And Jolle might consider using the Accept-Language header to pre-
> populate the default language choice.  I know you (Johan) were  
> playing with it at one point.  Did you ever get the code working?

It's not that I have forgotten about this possibility. But for my use  
I prefer to have a language that the admin for the site can control.  
And then if admin allows it to let the user switch. If the switch take  
place automatically then I fear that it can cause confusion for my  
type of users. Mostly intranet.

HDB
Jolle

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by bilcorry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jolle Carlestam wrote on 5/16/2008 8:40 AM:
> If the switch take place automatically then I fear that it can cause
> confusion for my type of users. Mostly intranet.

No, not automatically.  Just when you allow the user to select their language, you default the choice to the preference given by the browser via the Accept-Language header.  So if I were to visit the site, it would prompt me for the language and select English as the default choice for me.  For your browser, it would select Swedish as the default choice.



- Bil


#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Nikolaj de Fine Licht :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 16. maj 2008, at 14:44, Jolle Carlestam wrote:

> Because I got a slap on the wrist from, I think, Bil. He told me  
> that se is the code for Sweden but sv is the code for Swedish. And  
> this does make a difference cause not only do we have several  
> languages in Sweden, Swedish is also the official language for at  
> least on other country, Finland.

OK thanks, I'll have to make a S&R on one of my current projects where  
I'm including Swedish as a language option :)

Yeah, I still in wait to experience a Bil-slap but they are said to be  
tough...

/nikolaj

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Making good use of the lang type

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 08.29 -0500 2008-05-16, Bil Corry wrote:
>And Jolle might consider using the Accept-Language header to pre-populate the default language choice.  I know you (Johan) were playing with it at one point.  Did you ever get the code working?

knop_lang -> browserlanguage sniffs the accept-language header and returns the most preferred language of the languages available in the lang object. It's up to the developer what to do with that info.

Language codes are defined by standard ISO 639

http://en.wikipedia.org/wiki/ISO_639

http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

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

#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
LightInTheBox - Buy quality products at wholesale price!