Sponsored Content
Full Discussion: Address of PATH variable
Top Forums Programming Address of PATH variable Post 302143171 by porter on Tuesday 30th of October 2007 11:39:34 PM
Old 10-31-2007
Now you have me worried, what are you going to do with it?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

passing ip address as a variable to script for ftp

Still a Beginner here .. Does anyone no how to get the IP address of the machine thats logged in (bearing in mind there will be others logged in) while they are logged in to the Unix server and pass this as a variable to a shell script so as I can FTP files to that machine via a shell script, at... (2 Replies)
Discussion started by: Gerry405
2 Replies

2. UNIX for Dummies Questions & Answers

$Variable address in sed

I'm attempting to append a line after a specific address with sed. If I type in the address eg.3 then it will append after the third line. I can't get it to work with a variable though. Does anyone know how to do it please? sed '/3/a\ text' filename :) sed '/\$address/a\ text' filename... (8 Replies)
Discussion started by: Sniper Pixie
8 Replies

3. UNIX for Dummies Questions & Answers

Help on setting path variable

Hi there, I need help on setting the path variable. How can I set the path variable with Bourne Shell. My scripts goes like this, but did not work. #!/bin/sh PATH=/usr/bin:/usr/ucb:/etc:/export/home/zchen/home export PATH Thanks, Z (4 Replies)
Discussion started by: randomcz
4 Replies

4. Shell Programming and Scripting

Getting the path from a variable

Hi, I am having a variable Like line="/dir1/dir2/gr3/file.ksh" I need to get the /dir1/dir2/gr3 alone. the no of directories may differ at each time. Please advice. thanks in advance. (3 Replies)
Discussion started by: vanathi
3 Replies

5. Shell Programming and Scripting

Sed variable substitution when variable constructed of a directory path

Hello, i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem. my var1 is a string constructed like this: filename1 filerev1 filepath1 my var2 is another string constructed like this: filename2 filerev2 filepath2 when i do... (2 Replies)
Discussion started by: alrinno
2 Replies

6. UNIX for Dummies Questions & Answers

address variable content with csh

By using a csh, I want to address a variable content whose name is/matches the content of a given other variable. i.e. set name=´sam´ set ${name}_age=´27´ So, by typing: echo ${name}_age I correctly obtain: sam_age By typing: echo $sam_age or echo ${sam_age} I correctly obtain: 27 ... (1 Reply)
Discussion started by: sobolev
1 Replies

7. Shell Programming and Scripting

remove a path from PATH environment variable

Hi I need a script which will remove a path from PATH environment variable. For example $echo PATH /usr/local/bin:/usr/bin:test/rmve:/usr/games $echo rmv test/rmve Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
Discussion started by: madhu84
9 Replies

8. Shell Programming and Scripting

one liner to extract path from PATH variable

Hi, Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable? for eg: suppose the PATH is being set as follows PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4 ... (2 Replies)
Discussion started by: royalibrahim
2 Replies

9. Shell Programming and Scripting

Appending a path in user's PATH variable

Hello Folks, I want to append a path in user's PATH variable which should be available in current session. Background Numerous persons will run a utility. Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies

10. Shell Programming and Scripting

Path a variable to sed that includes a path

Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example start="BEGIN /home/mavkoup/data" end="END" sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Discussion started by: mavkoup
4 Replies
Petal::I18N(3pm)					User Contributed Perl Documentation					  Petal::I18N(3pm)

NAME
Petal::I18N - Attempt at implementing ZPT I18N for Petal SYNOPSIS
in your Perl code: use Petal; use Petal::TranslationService::Gettext; my $translation_service = new Petal::TranslationService::Gettext ( locale_dir => '/path/to/my/app/locale', target_lang => gimme_target_lang(), ); my $template = new Petal ( file => 'example.html', translation_service => $translation_service ); # we want to internationalize to the h4x0rz 31337 l4nGu4g3z. w00t! my $translation_service = Petal::TranslationService::h4x0r->new(); my $template = new Petal ( file => 'silly_example.xhtml', translation_service => $ts, ); print $template->process (); I18N Howto Preparing your templates: Say your un-internationalized template looks like this: <html xmlns:tal="http://purl.org/petal/1.0/"> <body> <img src="/images/my_logo.png" alt="the logo of our organisation" /> <p>Hello, <span petal:content="user_name">Joe</span>.</p> <p>How are you today?</p> </body> </html> You need to markup your template according to the ZPT I18N specification, which can be found at http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ZPTInternationalizationSupport <html xmlns:tal="http://purl.org/petal/1.0/" xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="my_app"> <body> <img src="/images/my_logo.png" alt="the logo of our organisation" i18n:attributes="alt" /> <p i18n:translate="">Hello, <span petal:content="user_name">Joe</span>.</p> <p i18n:translate="">How are you today?</p> </body> </html> Extracting I18N strings: Once your templates are marked up properly, you will need to use a tool to extract the I18N strings into .pot (po template) files. To my knowledge you can use i18ndude (standalone python executable), i18nextract.py (part of Zope 3), or I18NFool. I use i18ndude to find strings which are not marked up properly with i18n:translate attributes and I18NFool for extracting strings and managing .po files. Assuming you're using i18nfool: mkdir -p /path/to/my/app/locale cd /path/to/my/app/locale i18nfool-extract /path/to/my/template/example.html mkdir en mkdir fr mkdir es i18nfool-update Then you translate the .po files into their respective target languages. When that's done, you type: cd /path/to/my/app/locale i18nfool-build And it builds all the .mo files. Making your application use a Gettext translation service: Previously you might have had: use Petal; # lotsa code here my $template = Petal->new ('example.html'); This needs to become: use Petal; use Petal::TranslationService::Gettext; # lotsa code here my $template = Petal->new ('example.html'); $template->{translation_service} = Petal::TranslationService::Gettext->new ( locale_dir => '/path/to/my/app/locale', target_lang => gimme_language_code(), ); Where gimme_language_code() returns a language code depending on LC_LANG, content-negotiation, config-file, or whatever mechanism you are using to decide which language is desired. And then? And then that's it! Your application should be easily internationalizable. There are a few traps / gotchas thought, which are described below. BUGS, TRAPS, GOTCHAS and other niceties Translation Phase The translation step takes place ONLY ONCE THE TEMPLATE HAS BEEN PROCESSED. So if you have: <p i18n:translate="">Hello, <span i18n:name="user_login" tal:replace="self/user_login">Joe</span> </p> It most likely will not work because the tal:replace would remove the <span> tag and also the i18n:name in the process. This means that instead of receiving something such as: Hello, ${user_login} The translation service would receive: Hello, Fred Flintstone Or Hello, Joe SixPack etc. To fix this issue, use tal:content instead of tal:replace and leave the span and its i18n:name attribute. Character sets I haven't worried too much about them (yet) so if you run into trouble join the Petal mailing list and we'll try to fix any issues together. Limitations At the moment, Petal::I18N supports the following constructs: xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:translate i18n:domain i18n:name i18n:attribute It does *NOT* (well, not yet) support i18n:source, i18n:target or i18n:data. perl v5.12.4 2011-08-25 Petal::I18N(3pm)
All times are GMT -4. The time now is 04:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy