[Geoprisma-users] i18n_* tooltip messages are showing

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jan 11 14:11:14 EST 2010


Yves Moisan wrote:
> Le vendredi 08 janvier 2010 à 23:02 -0500, Stephen Woodbridge a écrit :
>> What cases the i18n_* text to be displayed instead of the actual 
>> language text. For example the text "i18n_fullzoom_tooltip" 

This is from the standard GeoExtToolbar widget when you add the 
navigation controls to it.

When you view source on the good server I see:

<script xmlns="" 
src="./widgets/geoexttoolbar/GeoExtToolbar.js"></script><script xmlns="" 
src="./widgets/geoexttoolbar/GeoExtToolbar.GeoExtToolbar.js"></script><script 
xmlns="">

 
Ext.apply(org.geoprisma.widget.geoexttoolbar.GeoExtToolbar.prototype, {
             i18n_zoomfull_tooltip : "Zoom to maximum extent",
             i18n_zoomin_tooltip   : "Zoom in : left click on map or 
draw a zoom box",
             i18n_zoomout_tooltip  : "Zoom out : left click on map or 
draw a zoom box",
             i18n_pan_tooltip      : "Pan : click left and drag",
             i18n_back_tooltip     : "Previous view",
             i18n_next_tooltip     : "Next view"
         });

     </script>

But on the bad server which is basically a copy of the good server with 
some path changed, I see:

<script xmlns="" 
src="./widgets/geoexttoolbar/GeoExtToolbar.js"></script><script xmlns="" 
src="./widgets/geoexttoolbar/GeoExtToolbar.GeoExtToolbar.js"></script><script 
xmlns="">

 
Ext.apply(org.geoprisma.widget.geoexttoolbar.GeoExtToolbar.prototype, {
             i18n_zoomfull_tooltip : "i18n_zoomfull_tooltip",
             i18n_zoomin_tooltip   : "i18n_zoomin_tooltip",
             i18n_zoomout_tooltip  : "i18n_zoomout_tooltip",
             i18n_pan_tooltip      : "i18n_pan_tooltip",
             i18n_back_tooltip     : "i18n_back_tooltip",
             i18n_next_tooltip     : "i18n_next_tooltip"
         });

     </script>

I expect that this is because I broke one of the paths in the config.php 
file. Everything else seems to be working OK, and checking the things 
that seemed obvious didn't show anything wrong. This looks like it is 
being generated from the widget xslt or via the php code the renders the 
widget.

woodbri at mapping:~/work/geoprisma/trunk$ find . -type f -exec grep -l 
i18n_zoomfull_tooltip {} \;
./src/client/widgets/geoexttoolbar/GeoExtToolbar.xslt
./src/client/widgets/geoexttoolbar/.svn/text-base/GeoExtToolbar.GeoExtToolbar.js.svn-base
./src/client/widgets/geoexttoolbar/.svn/text-base/GeoExtToolbar.xslt.svn-base
./src/client/widgets/geoexttoolbar/GeoExtToolbar.GeoExtToolbar.js
./languages/fr_CA/LC_MESSAGES/.svn/text-base/geoexttoolbar.po.svn-base
./languages/fr_CA/LC_MESSAGES/.svn/text-base/geoexttoolbar.mo.svn-base
./languages/fr_CA/LC_MESSAGES/geoexttoolbar.mo
./languages/fr_CA/LC_MESSAGES/geoexttoolbar.po
./languages/.svn/text-base/geoexttoolbar.pot.svn-base
./languages/fa_AF/LC_MESSAGES/.svn/text-base/geoexttoolbar.po.svn-base
./languages/fa_AF/LC_MESSAGES/.svn/text-base/geoexttoolbar.mo.svn-base
./languages/fa_AF/LC_MESSAGES/geoexttoolbar.mo
./languages/fa_AF/LC_MESSAGES/geoexttoolbar.po
./languages/geoexttoolbar.pot
./languages/en_US/LC_MESSAGES/.svn/text-base/geoexttoolbar.po.svn-base
./languages/en_US/LC_MESSAGES/.svn/text-base/geoexttoolbar.mo.svn-base
./languages/en_US/LC_MESSAGES/geoexttoolbar.mo
./languages/en_US/LC_MESSAGES/geoexttoolbar.po
./script/NaturalDocs/Data/.svn/text-base/SymbolTable.nd.svn-base
./script/NaturalDocs/Data/SymbolTable.nd

So looking at ./src/client/widgets/geoexttoolbar/GeoExtToolbar.xslt it 
generates the JS above with lines like:

     <script>

 
Ext.apply(org.geoprisma.widget.geoexttoolbar.GeoExtToolbar.prototype, {
             i18n_zoomfull_tooltip : <xsl:value-of 
select="php:functionString('GeoExtToolbar::getText','i18n_zoomfull_tooltip','JS')" 
/>,
             i18n_zoomin_tooltip   : <xsl:value-of 
select="php:functionString('GeoExtToolbar::getText','i18n_zoomin_tooltip','JS')" 
/>,
             i18n_zoomout_tooltip  : <xsl:value-of 
select="php:functionString('GeoExtToolbar::getText','i18n_zoomout_tooltip','JS')" 
/>,
             i18n_pan_tooltip      : <xsl:value-of 
select="php:functionString('GeoExtToolbar::getText','i18n_pan_tooltip','JS')" 
/>,
             i18n_back_tooltip     : <xsl:value-of 
select="php:functionString('GeoExtToolbar::getText','i18n_back_tooltip','JS')" 
/>,
             i18n_next_tooltip     : <xsl:value-of 
select="php:functionString('GeoExtToolbar::getText','i18n_next_tooltip','JS')" 
/>
         });

     </script>

So it looks like functionString() is failing, for some reason, to find 
and return the appropriate string. I'll dig into this a little more, but 
if you have any ideas that would be great.

Thanks,
   -Steve



> I can't find that string in any of the po files.  Is that a string of
> yours ?  
> 
> If i18n strings work but not this one, then you have to ensure you have
> valid .pot/.po/.mo files for the *domain* (defined in the php file of a
> particular widget).  Also, there are times when you need to restart
> Apache for GetText to pick up a new string.  
> 
> If you don't want to bother with domains (you should if you develop a
> new widget though) you can use the language code syntax as mentioned in
> the docs.  
> 
> For example in this case :
> 
> <shortcut>
>     <name>MyShortcutWidget</name>
>     <options>
>         <field>hap_nm_top</field>
>         <emptyText>
>             <domain>sampleFile</domain>
>             <key>i18n_shortcut_emptyText</key>
>         </emptyText>
>     </options>
> </shortcut>
> 
> GetText will look for the "i18n_shortcut_emptyText" string in the
> sampleFile.mo (compiled po) file and will render it in whatever language
> as determined in the cookie by the last lang= URL parameter assignment.
> Beware : the value of the language parameter lives for as long as it is
> not changed, so if you set it to fr_CA once it will always be that
> unless you explicitly change it in the url.  That can be misleading
> because the default language is English, which is what you get if you
> don't pass a lang url parameter; however if you set it to another
> language then that language becomes the default and then you'll wonder
> why you see some French while there is no lang url parameter.
> 
> If you want to bypass having to create a po file (which you then need to
> compile into an mo with an editor like poEdit), you can use the
> "language code" syntax as follows : 
> 
> <shortcut>
>     <name>MyShortcutWidget</name>
>     <options>
>         <field>hap_nm_top</field>
>         <emptyText>
>             <fr_CA>Racourcie sur le top</fr_CA>
>             <en_US>Shortcut to top</en_US>
>             <!-- Other lang -->
>         </emptyText>
>     </options>
> </shortcut>
> 
> HTH,
> 
> Yves
> 
>> is being 
>> displayed regardless of ?lang=en_US or ?lang=fr_CA or no lang argument.
>>
>> $g_strLocaleDir = '/u/software/geoprisma/trunk/languages' which it correct.
>>
>> -Steve
> 
> 



More information about the Geoprisma-users mailing list