Language Scope

Hey guys,

I didn’t think about this thoroughly enough and ran into some issues. I had a language file, here is a quick rough draft example:

english.php

$language = array();

$language['users'] = array(
	'createSave_email_subject' => ' - New User Account',
	'createSave_email_pass' => 'The user was created, and an email was sent to them!',
	'createSave_email_fail' => 'The user was created, but an email was <b>not</b> sent to them due to a mail error.',
);

I need to place this into various functions inside Model objects.

1: Should I make this a Static Class?

Language::createSave_email_subject;

2: Should I do a regular class?


function __construct() {
  parent::__construct();
  $this->Language = new Language();
}

$this->Language->createSave_email_subject;

3: I think constants would be a bad idea

function dosomething() {
  $this->result = CREATESAVE_EMAIL_SUBJECT;
}

Is there a good way to go about this? :slight_smile: I shy away from Static classes for the most part so I can have a structured call stack, but in this case It’d be obvious for languages.

Can static use __get() I forgot!

No, it cannot.

Ah, that makes me want to use a standard class Im thinking then… :slight_smile:

you can use _callStatic

Thats a great one Ill keep in mind, I went away from the Static style this time but thanks for suggesting this :slight_smile: