Click here to Skip to main content
16,016,605 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi every body
I want when my page load the Persian language set as default language for key Word
how can do that?
please help me.

What I have tried:

how to set default language for asp.net page in load page event
Posted
Updated 6-Apr-16 11:56am
Comments
Sergey Alexandrovich Kryukov 6-Apr-16 17:46pm    
Why? I don't thin you ever need it. This is not how languages really are supported. Just use encoding and RTL.
It's important that you prescribe HTTP-EQUV in each file, never relying on server's settings, if they even exist.
Do I have to explain why? With Web pages, it's generally very important not to rely on defaults.
—SA

1 solution

This is not "language". The whole idea to specify a language is outdated and generally bad. Think what happesn that your page if many pages is written with mixed fragment of Latin, your Perso-Arabic script, and, say, Devanāgarī and Cyrillic? Where your "defaults" will be applied? The whole idea is wrong. With Web, we use Unicode, which allows us to mix any number of different languages in one string.

All your pages need the following fragment:

HTML
<html>
   <head>
      <title>Some titlle</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <!-- ... -->
   </head>
<body>

<!-- ... -->

</body>
</html>

Naturally, the text of ASP.NET or HTML file should also be saved in UTF-8.

What happens if you rely on the server/side defaults? Think about the interests of the users who may want to just save a page locally. Not having proper HTTP-EQUIV will screw up rendering.

It will work without RTL, but, for some second-order reasons, it's good to specify it in CSS. Please see:
direction — CSS | MDN[^].

—SA
 
Share this answer
 
v5
Comments
rezaeti 7-Apr-16 22:00pm    
thanks.
rezaeti 7-Apr-16 22:00pm    
thanks.
Sergey Alexandrovich Kryukov 7-Apr-16 22:03pm    
You are welcome.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900