17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2105 Views |
-
Language files with modules

1 October 2008 at 9:44pm
Hi all,
I have two questions here:
1) I have created a module and am pretty sure i have the correct directory structure. The module is pretty much empty right now since i am only trying to fix this issue for now. Basically my en_US.php file contains a load of translations, but non of them are being used. I have tried putting an echo and exit into the php file but nothing happens so i assume it is not being loaded at all. How do i fix this?
2) How do i get the current username? I have tried using Member::getName() and Member::getTitle() but both are returning blank. Although i can get the userID from Member::currentUserID().
Thanks for your help all.
Harry
-
Re: Language files with modules

7 October 2008 at 12:41am
1) Can you provide a sample of your en_US.php through pastie.org? Did you i18n::enable() in your _config.php? Are you using _t() to echo the translated strings in your PHP file? Is the echo code in a valid Silverstripe model or controller?
2) $member = Member::currentUser();
echo $member->FirstName;
echo $member->Surname;
echo $member->Title; (firstname and surname) -
Re: Language files with modules

16 October 2008 at 3:45am
1) my en_US.php file includes:
<?php
global $lang;
$lang['en_US']['TestLinksAdmin_left.ss']['TESTLINKSHELP'] = 'Admin Testing Links Help';
?>
Just as a sample.
i18n::enable() is in my config and i am using _t() to echo.
My silverstripe install won't build the manifest as it says there are more than one file the same!!
Surely you must be able to have more than one language file so that lang files can be distributed with modules?
Plus the tutorial says to create this file.
2) Thanks, perfect!
Cheers
Harry
-
Re: Language files with modules

16 October 2008 at 3:56am
whats the path to your en_US.php relative to the webroot?
do you have a _config.php in your module root?
do you have a _manifest_exclude file in your module /lang folder?you should create the lang master tables through the i18n/textcollector command, which makes sure its the right format - and is simpler to use than manual copypaste as well
-
Re: Language files with modules

16 October 2008 at 9:22pm
Ok so the manifest builder does not complain any more.
How do i run the text collector function to get all my lang stuff together since it is still not displaying in the CMS correctly.
Harry
-
Re: Language files with modules

16 October 2008 at 9:27pm
read the i18n documentation
http://doc.silverstripe.com/doku.php?id=i18n -
Re: Language files with modules

16 October 2008 at 9:32pm
Oh yeah silly me.
any chance you could take a look at my other post. immediately under this one?
Harry
| 2105 Views | ||
|
Page:
1
|
Go to Top |


