Skip to main content
Topic: Language Files in own namespace? (Read 90 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Language Files in own namespace?

Hi,

I think this is more of a question for @Spuds or @emanuele‍, but is it possible to put the language files in their own namespace? The development branch of TinyPortal I have got most things into the TinyPortal namespace. https://github.com/Tinyportal/ElkTP/tree/development/TinyPortal I need to move the last of the article stuff from TPortalAdmin and TPArticle into the relevant files Article and ArticleAdmin then all I have remaining is the Portal.subs.php (I can just move this) and the language files. The JS, CSS and images folder I can move and change all the paths we set in TinyPortal so that again is easy enough. However I can't work out how to set a new language path like you can with the Themes like I do here; https://github.com/Tinyportal/ElkTP/blob/14a36dd03ecf87121e45d47fb4a7a3be50f70e75/TinyPortal/Integrate.php#L512

I also couldn't work out how to manipulate the autoload to look in the TinyPortal namespace, so I added my own. It means the hooks show as not working (although they are) but everything else works as I would expect in the TinyPortal namespace and allows me to reference out to Elkarte where needed and when 2.0 is released update the references to it's namespace.

 

Re: Language Files in own namespace?

Reply #1
Sorry for the delay, been busy working on some PR's

I'm actually not sure about this, the autoloader in 1.1 is a bit strange since the file naming and directory structure were not PSR (2.0 is).
You should be able to place the files in a directory and add them to the loader as
Code: [Select]
$autoloader = Elk_Autoloader::instance();
$autoloder->register(YOURDIR, '\\YOURNAMESPACE');
but I'm just not sure with language files since I've never tried this.
Be safe, Be kind, Happy Programing