[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.
doktornotor
Registered User
Posts: 27
Joined: Wed Dec 21, 2011 5:34 pm

Re: [RFC] Style-specific language variables

Post by doktornotor »

Unknown Bliss wrote:Maybe have the default language with a default suffix or default prefix?
I do not really see how this makes sense. Default needs to be whatever phpBB default is (i.e., (British) English ATM), not whatever language the style author thinks should be the default.

User avatar
Arty
Former Team Member
Posts: 985
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: [RFC] Style-specific language variables

Post by Arty »

I think whole logic in that pull request is wrong.

Current logic:
1. Include forum's default language pack
2. If user's language pack is different from default, include it too

First of all, it doesn't check for template inheritance. Language variables are used only in templates, therefore template inheritance must apply to language files as well.

Second, why include two files? Second file will override first file, making first include pointless. I think translations should include all text, not only modified lines.

Third, what about English pack? Most styles include only English imageset. If a forum has default language different from English, point of default language pack will fail.

I think this would be correct logic:
1. Check if template inheritance is active, if it is go to #1a, if its not go to #2a
1a. Include user's language pack from original template if it exists
1b. If #1a failed, include forum default's language pack from original template
1c. If #1b failed, include English language pack from original template
2a. Include user's language pack for current template if #1a - #1c failed.
2b. If #2a failed, include forum's default language pack
2c. If #2b failed, include English language pack

That way only 1 file is included with bunch of elseif() checks.

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

Re: [RFC] Style-specific language variables

Post by imkingdavid »

Arty wrote:I think whole logic in that pull request is wrong.

Current logic:
1. Include forum's default language pack
2. If user's language pack is different from default, include it too

First of all, it doesn't check for template inheritance. Language variables are used only in templates, therefore template inheritance must apply to language files as well.
Good point. I'll need to work on checking for template inheritance.
Second, why include two files? Second file will override first file, making first include pointless. I think translations should include all text, not only modified lines.
Fallback. What if the second file (user's language) does not include some of the variables used in the template, but they are present in the board default language file?
Third, what about English pack? Most styles include only English imageset. If a forum has default language different from English, point of default language pack will fail.
English is default on new phpBB installations and must be present in all MODs (and therefore, now in any styles that include language variables). I do agree that if the board default is different from English it won't find the file if one is not present, but that is why it also checks for the user specified language as well.
I think this would be correct logic:
1. Check if template inheritance is active, if it is go to #1a, if its not go to #2a
1a. Include user's language pack from original template if it exists
1b. If #1a failed, include forum default's language pack from original template
1c. If #1b failed, include English language pack from original template
2a. Include user's language pack for current template if #1a - #1c failed.
2b. If #2a failed, include forum's default language pack
2c. If #2b failed, include English language pack
I'll think about this a bit more and work on trying to get template inheritance implemented.
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
Arty
Former Team Member
Posts: 985
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: [RFC] Style-specific language variables

Post by Arty »

imkingdavid wrote:Fallback. What if the second file (user's language) does not include some of the variables used in the template, but they are present in the board default language file?
Those are style specific language packs, there is no reason for them not to include some variables.
imkingdavid wrote:English is default on new phpBB installations and must be present in all MODs (and therefore, now in any styles that include language variables). I do agree that if the board default is different from English it won't find the file if one is not present, but that is why it also checks for the user specified language as well.
This is language pack for style, not for forum. When user installs language pack for forum, he always uploads language specific files, otherwise he wouldn't be able to install it. When user installs style, he expects it to just work and can't be bothered with going through style's files to create his custom language pack. That's why I think there should be ether "default.php" or it should fall back to English language pack.

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

Re: [RFC] Style-specific language variables

Post by imkingdavid »

Alright, so I have updated my pull request to take template inheritance into account. It also now only includes one file at a time (or two if there is template inheritance), and falls back on english if neither the user language nor the board default language are present. And because it is not mandatory for styles to include language variables, there is no error if none of the files exists.
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
Arty
Former Team Member
Posts: 985
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: [RFC] Style-specific language variables

Post by Arty »

Looks good :D

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 »

What happened to this?
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.

Post Reply