/    Sign up×
Community /Pin to ProfileBookmark

how would i detect hebrew?

hi,
i have a table containing both ENGLISH an HEBREW characters.
i want to check if a text inside all TDs is hebrew or english.
if english do nothing – if hebrew “text-align: right”

[B]how would i do that?[/B]

[URL=http://www.alanwood.net/unicode/hebrew.html]in this link[/URL] you can see the Decimal and Hex code for those hebrew characters.
starting at decimal =1488….. ending at decimal = 1514

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@JPnycDec 29.2005 — [url=http://www.c-point.com/javascript_tutorial/constructor.htm]This[/url] should help. Lays it out pretty much completely.
Copy linkTweet thisAlerts:
@ofirauthorDec 30.2005 — this is what i came out with:

[code=php]
function detect_hebrew(){
if(document.getElementsByTagName){

alert('');
var cells = document.getElementById('list').getElementsByTagName("td");
for (var i=1;i<cells.length;i++) {
var str=cells[i].innerHTML;
var c ;
for (x=0;x<str.length;x++) {
c = str.charAt(x);
if (c>='decimal' && c <='decimal')
alert('hebrew');
}
}
}
}
[/code]


is it any good?

how do i write a DECIMAL or HEX code in the [B]if[/B]? (where is says 'decimal')?
Copy linkTweet thisAlerts:
@ofirauthorDec 30.2005 — ???
Copy linkTweet thisAlerts:
@FromU2MEDec 30.2005 — Can't you create a CSS class only for hebrew, or perhaps a variable that predefines whether the td is in hebrew or not... ?

Because, doing it your way is doing it [B]the hard way[/B]...
Copy linkTweet thisAlerts:
@ofirauthorDec 31.2005 — well...

i dont know what would be the content !!

could be either language!

it is dynamic!

can i check with CSS what language a text is?
Copy linkTweet thisAlerts:
@FromU2MEDec 31.2005 — Even if it's a dynamic content (created by i.e. PHP) you can create a variable or a class in CSS that will decide the text-align.

It would help if you could sent some code - feels like I'm guessing blind here...
Copy linkTweet thisAlerts:
@ofirauthorDec 31.2005 — if u know a way to identify the text language with only css SHARE IT with me !!

this will be the best solution!!!

(but idont think there is)

as for the code:

make a table with any number of TR and any number of TD.

inside each of those TD will come text - english or hebrew.

where would be english/hebrew? [B]i can never tell !!![/B]

thats why i choose JS !!

i know one thing though - its enough that i find[B] one[/B] letter Hebrew inside a td to make it align right.
Copy linkTweet thisAlerts:
@ofirauthorJan 01.2006 — bump..

somebody?
×

Success!

Help @ofir spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...