[RFC] Style-specific language variables

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

[RFC] Style-specific language variables

Post by imkingdavid »

EDIT -- Links:
Ticket
Pull Request
--------
In this topic it was brought up that style authors are limited to using only the language entries provided in the core installation.

This prevents the inclusion of new style-specific sections (such as a Quick Links menu). Currently, they can just use an image (to prevent getting denied for using Hard Coded language text), but there is an RFC to remove imagesets (for language-specific images) in 3.1.

As such, there arises a need for styles to be able to include their own language variables so that they can include new style components easily.

There are two main ways I see of implementing this, (extact file naming/structure is up for discussion):
  • Put the file in the language directory (such as language/en/style/prosilver.php or language/en/style_prosilver.php)
    • Upside, language files stay together
    • Downside is that the style isn't just one nice directory to download and upload into the styles/ folder.
  • Put language file in styles directory (such as styles/prosilver/lang/en.php) Update: This is the preferred method.
    • Upside, style files are all contained in their style directory
    • Downside, language files are no longer all in the language/ directory.
In either case there would need to be changes in the language system to have it search for files automatically in whichever location is chosen. if the file doesn't exist for the current language, default to board default. If no file exists, just don't include one.

Ideas? Thoughts? Things I missed?
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: [RFC] Style-specific language variables

Post by MichaelC »

My suggestion in the topic you linked to about asking for them to be added makes more sense as it means that they will always get translated (part of the main package) and requires no core code apart from adding the lines (and maybe a comment) to language files.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1904
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [RFC] Style-specific language variables

Post by DavidIQ »

imkingdavid wrote:[*]Downside is that the style isn't just one nice directory to download and upload into the styles/ folder.
Wouldn't really matter since the admin user would ideally be just clicking a few buttons or links in the admin panel to both download and install the style. ;-) (only those installing "unofficial" or demo styles would notice)
With that in mind I say keep it with the other language files.
Image

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] Style-specific language variables

Post by Oleg »

How about using extensions for this?

Use the style name as extension name and put language into the correct location.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] Style-specific language variables

Post by callumacrae »

I would prefer to see it in styles/style/lang/en.php - why shouldn't style language changes go with the style? It doesn't make sense to have it anywhere else.
Made by developers, for developers!
My blog

User avatar
Ger
Registered User
Posts: 293
Joined: Mon Jul 26, 2010 1:55 pm
Location: 192.168.1.100
Contact:

Re: [RFC] Style-specific language variables

Post by Ger »

When thinking of the self contained MODs, I guess the most logical approach would also be a self contained style. Therefore, having the style-specific language file in the same dir as the other style-specific files.
Above message may contain errors in grammar, spelling or wrongly chosen words. This is because I'm not a native speaker. My apologies in advance.

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC] Style-specific language variables

Post by imkingdavid »

That's settled, then. It'll go in a new lang/ or language/ directory in styles. Shouldn't be too hard to implement. Anyone wanna take a stab at this? I'm currently working on quite a few features at the moment and while I could eventually get around to this, I should finish up what I'm doing now first. It also needs a ticket created in the tracker.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: [RFC] Style-specific language variables

Post by MichaelC »

Would it be so its included on all pages (like common.php) or would there be any code in the language file to say which pages it should be included in (like a sort of hook)?
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC] Style-specific language variables

Post by imkingdavid »

Unknown Bliss wrote:Would it be so its included on all pages (like common.php) or would there be any code in the language file to say which pages it should be included in (like a sort of hook)?
Basically here's how I see it working (could be other implementations, of course):
  • Style includes language files in style/***/lang/ directory, named with their language code (e.g. en.php)
  • When page loads and style is determined in $user->setup(), it checks to see if there is a language file in the style directory that is the same as the user's chosen language.
  • If there is, add it as a language file (similar to $user->add_lang() except check in the style language folder)
  • If not, check for the board default language file in the folder. If it's there add it to the language
  • If neither the user's chosen language nor the board default language have corresponding style language files, forget about it and get on with your life. :lol:
EDIT: so to answer your question, yes it would be loaded on every page within $user->setup().

Once this is implemented, we would need to let style authors/translators know about it so that they can implement it when working on 3.1 styles.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

keith10456
Registered User
Posts: 523
Joined: Sat Apr 22, 2006 10:29 pm
Contact:

Re: [RFC] Style-specific language variables

Post by keith10456 »

Great style change... Kudos to the team ;)

Post Reply