Custom Language Files

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Scam Warning
Post Reply
User avatar
jackennils
Registered User
Posts: 229
Joined: Mon Jun 01, 2009 7:48 pm

Custom Language Files

Post by jackennils »

Hey there!

Imagine you have a board which user you don't want to call user or member, but maybe player. Or something else, it doesn't matter. And you also want to change some other terms from the common.php language file or any other. But if you change the original files, your changes are gone after the next update.

It would be great to have an extension that allows to modify the core language files and sits on top of them. So all changes you have made are still there after the update.

Something like this...
viewtopic.php?f=456&t=2275361
... but only for language files.


Hope you understand what I'm thinking about. :)
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Custom Language Files

Post by 3Di »

That's easy top do I believe.

Make a simple extension which calls the event core.user_setup_after then make a function which calls a common.php language file.
IE.

Code: Select all

	/**
	 * Load extension language file during user set up.
	 *
	 * @return void
	 * @access public
	 */
	public function setup_lang()
	{
		$this->lang->add_lang('common', 'vendor_name/package_name');
	}
At this point copy/paste all the original language strings you want to modify into that common.php, modify the description as you wish.
IE. from the native

Code: Select all

	'WARN_USER'			=> 'Warn user',
to yours

Code: Select all

	'WARN_USER'			=> 'Warn citizen',

Enabling the estension the result should be to override the native language.
πŸ†“ Free support for our extensions also provided here: phpBB Studio
πŸš€ Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity ΒΊ PhpStorm's proud user ΒΊ Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
jackennils
Registered User
Posts: 229
Joined: Mon Jun 01, 2009 7:48 pm

Re: Custom Language Files

Post by jackennils »

Sounds good, if someone is willing to realize this, I would be very grateful. :)
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Custom Language Files

Post by david63 »

I think that in theory you are right Marco but in practice it may not always work 100% as it is dependant on when and how the language files are loaded and there is a possibility that the common language file could be loaded after the extension language file (probably unlikely but possible)
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
</Solidjeuh>
Registered User
Posts: 1788
Joined: Tue Mar 29, 2016 3:45 am
Location: Aalst (Belgium)
Name: Andy Dm
Contact:

Re: Custom Language Files

Post by </Solidjeuh> »

See my ext: https://github.com/Solidjeuh/BoardMagic
You can add css, html & language strings
User avatar
jackennils
Registered User
Posts: 229
Joined: Mon Jun 01, 2009 7:48 pm

Re: Custom Language Files

Post by jackennils »

Interesting. Does you ext consider david's concerns?
User avatar
</Solidjeuh>
Registered User
Posts: 1788
Joined: Tue Mar 29, 2016 3:45 am
Location: Aalst (Belgium)
Name: Andy Dm
Contact:

Re: Custom Language Files

Post by </Solidjeuh> »

jackennils wrote: ↑Mon Nov 19, 2018 3:53 pm Interesting. Does you ext consider david's concerns?
This ext overrides the core language strings. never had any problems with it.
User avatar
jackennils
Registered User
Posts: 229
Joined: Mon Jun 01, 2009 7:48 pm

Re: Custom Language Files

Post by jackennils »

Okay, I'll give it a try. Thanks again.
User avatar
jackennils
Registered User
Posts: 229
Joined: Mon Jun 01, 2009 7:48 pm

Re: Custom Language Files

Post by jackennils »

I just gave it a try and it seems that every time I change something, at least if it is css, I need to disable and re-enable the ext for the changes to appear. Correct? I was more or less thinking about a more convenient solution with a nice interface. But it'll do the job for now.
User avatar
</Solidjeuh>
Registered User
Posts: 1788
Joined: Tue Mar 29, 2016 3:45 am
Location: Aalst (Belgium)
Name: Andy Dm
Contact:

Re: Custom Language Files

Post by </Solidjeuh> »

jackennils wrote: ↑Mon Nov 19, 2018 10:31 pm I just gave it a try and it seems that every time I change something, at least if it is css, I need to disable and re-enable the ext for the changes to appear. Correct? I was more or less thinking about a more convenient solution with a nice interface. But it'll do the job for now.
That's normal. If you change something in css you need to clear the forum cache + browser cache (CTRL F5)
Same goes for other ext and style changes
Senky
Former Team Member
Posts: 2300
Joined: Thu Apr 30, 2009 8:49 pm
Name: Jakub
Contact:

Re: Custom Language Files

Post by Senky »

Just purge the cache in ACP, it should automatically add a new asset_version to every file, thus forcing browsers to reload them.
β€Žβ€β€ β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Ž β€Žβ€β€Žβ€β€β€Ž β€Ž β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Ž β€Žβ€β€β€Žβ€β€β€ŽπŸ””
Browser & Mobile Notifications Extension
Now with Safari (both macOS and iOS) support!
Post Reply

Return to β€œExtension Requests”