![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| output in different languages | bora99 | Shell Programming and Scripting | 2 | 01-31-2008 02:47 AM |
| Operating System and Programming languages | jacx2 | UNIX for Advanced & Expert Users | 2 | 04-15-2002 08:59 AM |
| Shell scripting & programming languages | aloysius1001 | UNIX Desktop for Dummies Questions & Answers | 1 | 02-18-2002 08:04 PM |
| scripting languages | headspin | UNIX for Dummies Questions & Answers | 3 | 01-31-2002 01:59 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
bash and languages
Hi everyone,
First of all, i dont know what id do without this forum its been such a great help anyway i have a simple question, if i wrote a scrpt in english would it work on another machine with a different language, or do i have to put something in the script to say its english etc, you get my drift, I big thankyou in advance for any help, and a big kiss if your a woman/lady |
| Forum Sponsor | ||
|
|
|
|||
|
What do you mean by "write a script in English"?
The command names like cat df awk etc are never localized, even though some of them coincide with English words (date, join, sort ...) Output from some commands will be localized, so if you are e.g. parsing the output from ls it might be different from what you expect if the user is in another locale. See man locale for an overview. If this is an issue for your script, export LC_ALL=C should force all commands to use a "traditional" C locale (meaning in practice English minus minus). If your script prints some messages in English, then of course, unless you take special precautions, your strings will be simply strings and won't change even if you would like them to. If you want to make your script localizable, look at gettext and other internationalization frameworks. |
|
|||
|
Quote:
thankyou for repying, yes what i meant was, i have a bash script written in english and if someone, eg german etc, wanted to use the script, would it it still work on their machine, ignoring the fact that they couldnt read it. So if i understand you right adding export LC_ALL=C to a script will allow it to work regardless of locale/language set on the users machine, |
|
|||
|
That's the idea, yes. Many of the standard Unix tools only have machine-readable output in the first place, so the effects should be minor. Mainly, anything to do with sort order, currency formatting, human-readable number formatting, date and time formats, measurements etc. is sensitive to locale settings, but many scripts don't touch these things much.
Globally clobbering the user's locale is not such a great idea, actually, so it might be better if you use LC_ALL=C only for those commands which actually require it (so grep "$regex" "$file" | LC_ALL=C sort | uniq >file for example). That way, they still see output in their own language if there is an error message from grep, for instance (provided of course that their copy of grep actually has a localized message catalog). Google a bit for i18n if you need more information about internationalization and localization. Last edited by era; 06-06-2008 at 12:34 AM. Reason: Maybe don't clobber LC_ALL globally after all |
|
|||
|
Hej,
I tried to translate it, but so far I got, it sound not very polite "cause of that, you talk with yourself" or in terms of "you would talk only with yourselves else" ? Help me, my swedish is as good as the translator can help me EDIT: You can send me a PM if you like to - saw you don't accept any. Last edited by zaxxon; 06-06-2008 at 01:43 AM. |
|||
| Google UNIX.COM |