Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

l18n - Install PHPUnit without PEAR or CLI


Go to End


3 Posts   1262 Views

Avatar
LePhil

Community Member, 3 Posts

22 June 2012 at 4:13am

Kia Ora, oh silverstriped ones!

I just started working on a little page in SS. So far I'm very happy and excited about it, as it's (at least for me) a new way to develop websites.

The problem is that the website should be in 3 languages. I enabled l18n

i18n::enable(); 
i18n::set_locale('de_CH');

and translated most of my pages. Now there are of course elements, like text in a footer or header, that aren't really content and are hardcoded in the template. As it's stated on here I made variables out of them:

<a href="http://www.silverstripe.com" title="<% _t('VISIT','Visit www.silverstripe.com') %>"> 

Now I should be able to collect all these strings via PHPUnit, right?
Unfortunately, I work on a hosted server and don't have access to a CLI or the core elements of the file system. There are ways, supposedly, to install PHPUnit without PEAR, but mostly require CLI access.

So. Is there any way I can get the l18n variable overview without CLI or PEAR? How?

And, almost as important: Will this give me a way to translate/change texts in different languages in the UI? Or do I have to change the text for each language in the database?

Any advice would be welcome, really. Have been trying to get it to work for 3 hours now without success.

Avatar
LePhil

Community Member, 3 Posts

3 August 2012 at 3:44am

It was too much of a hassle with our hoster, so we did the list by hand. It's not that much work, anyway :)

Closed, I'd say.

Avatar
brooklyngem

Community Member, 2 Posts

1 September 2013 at 7:32am

Edited: 01/09/2013 7:33am

Hi LePhil,

I'm having similar issue. (I have 3.0 installed on a hosted server.) Since I don't have a whole lot of hard coded text that need to be translated, I want to manually create the translation file instead of running the text collector.

Where did you place the translation file and how do you format it?

I tried creating a file in: mysite/lang/en_US.yml

Then entered the text like this:

en_US:
NameSpace:
HelloWorld: 'Hello World!'

Then in the template, I added the translation like this:

<%t NameSpace.HelloWorld "Hello World!" %>

But it's not working. :S What am I doing wrong?? I'd appreciate any help!