Should be pretty simple, really.
What programming language(s) are you using?
Main Topics
Browse All TopicsHi,
I have a form where user´s can input the color code of their choice for the body background. The problem is the users are portuguese speakers who wouldnt use words such as blue, green etc.. in english. inputting the code itself such as #ffffff might be too complicated.
Does HTML provide any provision for foreign language color codes? If it does, how do I use it?
thnx,
sg
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Lets assume you are using ASP. You can modify this to any other language as it is pretty simple.
Lets say your color choice is in a form field called "color". At the top of the ASP page just include this code:
<%
Color = request.form("color")
If Color = "Azul" then
bgcolor = "blue"
Elseif Color = "Vermelho" then
bgcolor = "red"
Else
bgcolor = "white"
End If
%>
Then the body tag would look like this:
<Body bgcolor='<%response.write(
All you have to do is save the page as name.asp
Hope this helps?
Peter
It would be more efficient to use a hash or dictionary.
PHP:
<?php
$colours = array("azul" => "0000FF", "vermelho" => "FF0000", "amarelo" => "FFFF00", "verde" => "00FF00",
"alaranjado" => "FF8800","branco" => "FFFFFF", "preto" => "000000");
?>
<p>Para selecionar uma cor do fundo:</p>
<select name="colours" onchange="document.body.st
<option value="">[Selecione por favor...]</option>
<?php
foreach($colours as $name => $hexval)
echo " <option value=\"#$hexval\">$name</
?>
</select>
ASP/VBScript:
<%
Colours = Server.CreateObject("Scrip
Colours.Add "azul", "0000FF"
Colours.Add "vermelho", "FF0000"
Colours.Add "amarelo", "FFFF00"
Colours.Add "verde", "00FF00",
Colours.Add "alaranjado", "FF8800"
Colours.Add "branco", "FFFFFF"
Colours.Add "preto", "000000"
%>
<p>Para selecionar uma cor do fundo:</p>
<select name="colours" onchange="document.body.st
<option value="">[Selecione por favor...]</option>
<%
For I = 0 To Colours.Count - 1
Response.Write "<option value=""#" & Colours.Items(I) & """>" & Colours.Keys(I) & "</option>" & VbCrLf
End For
%>
</select>
I wonder if there's a literal translation for lightgoldenrodyellow...
Perhaps the easiest solution is built into the question - color itself is universal - so perhaps provide a link to a color chart (your's or someone else's) that they can click on a color and populate the form - or just copy and paste...
I've done a sample here that will populate the form...
http://www.pdgmedia.com/co
Here's an idea:
If you're using a form already, why not have a select list that displays available colors? Like this:
<select name="BGcolor" style="width: 40px; height: 200px">
<option value="Black" style="background-color: Black;">
<option value="Maroon" style="background-color: Maroon;">  
<option value="Green" style="background-color: Green;">
<option value="Olive" style="background-color: Olive;">
<option value="Navy" style="background-color: Navy;"> <
<option value="Purple" style="background-color: Purple;">  
<option value="Teal" style="background-color: Teal;"> <
<option value="Gray" style="background-color: Gray;"> <
<option value="Silver" style="background-color: Silver;">  
<option value="Red" style="background-color: Red;"> </
<option value="Lime" style="background-color: Lime;"> <
<option value="Yellow" style="background-color: Yellow;">  
<option value="Blue" style="background-color: Blue;"> <
<option value="Fuchsia" style="background-color: Fuchsia;"> &nbs
<option value="Aqua" style="background-color: Aqua;"> <
<option value="White" style="background-color: White;" selected>  
</select>
HEX values would be best - hang on, I'll have that in a minute...
this should give you the idea:
<select name="BGcolor" style="width: 40px; height: 200px">
<option value="#000000" style="background-color: #000000;"> &nbs
<option value="#840000" style="background-color: #840000;"> &nbs
<option value="#008200" style="background-color: #008200;"> &nbs
<option value="#848600" style="background-color: #848600;"> &nbs
<option value="#FFFFFF" style="background-color: #FFFFFF;" selected>  
</select>
Note - to add to the previous link:
http://www.pdgmedia.com/co
You can also do this without names at all, obviously, since whether the color is called lightgoldenrodyellow or not, it really doesn't matter. It could just as well be called sunshine - or paella.
http://www.pdgmedia.com/co
Well, it turns out someone did take the time to translate lightgoldenrodyellow, along with all the others. So here you go:
http://www.pdgmedia.com/co
Business Accounts
Answer for Membership
by: ho_alanPosted on 2003-12-12 at 17:08:00ID: 9932268
why not use a table to map the colour?
when user enters portugese blue, then it will map to "blue" of HTML
so that u can still use <xxx color=blue>
do u get my meaning ? :-)