YaBB Community and Support Forum
YaBB Home About YaBB Download YaBB YaBB Support Customize Your Forum Development Contribute to the Project
  Welcome, Guest. Please Login or Register


 
Pages: 1 2 3 4 5
Topic Tools
 
Optimizing .lng files (Read 18,795 times)
 Reply #15 - Jun 27th, 2009 at 6:37pm
There are no actions to perform.  

cepheid 
Senior Member
****
Offline
Posts: 516


None
Re: Optimizing .lng files
batchman wrote on Jun 27th, 2009 at 6:34pm:
So what did I miss, and does it fall under the header of not knowing the technology portion well enough to correct it?

No, just a few readability issues.  Totally minor.
 
WWW  
IP Logged  
 Reply #16 - Jun 27th, 2009 at 10:57pm
There are no actions to perform.  

OH Eng 
Past Team Members
Documentation Team
Offline
Posts: 4,026
Pensacola, Florida USA


None
Re: Optimizing .lng files
Quote:
For trying to figure out which lines of code are no longer referenced anywhere, how would you figure out which files to check? Or would you check all the /Sources, /Admin, and /YaBB2 files for every line?


@Batchman

One fairly reliable way to find where things are used in the code is to download Notepad++ and use the "Search In Files" plugin.  Note that you will have to use a version other than the most current version, because the most current one does NOT support Search in Files.  I use v4.9.

Then you can search all files in the download for whatever you are looking for.  With .lng entries, you'll see it shows the .lng file itself and any file anywhere that calls it, complete with line number of the code.

The advantage of this is it catches any instances where a .lng file was referenced where another, different one might have been better.  Something in X.pl might obviously reference X.lng, but it could reference Y.lng or Main.lng.  I think most of those are gone now, but I'm not sure there isn't a couple still hanging around.

 

« Last Edit: Jun 27th, 2009 at 10:57pm by OH Eng »  
 
OH Eng  
IP Logged  
 Reply #17 - Jun 28th, 2009 at 12:54am
There are no actions to perform.  

batchman 
Support Team
****
Offline
Posts: 371
Orlando, FL


None
Re: Optimizing .lng files
Cool ... I'll look into that!

Thanks, OH Eng!
 
 
IP Logged  
 Reply #18 - Jun 28th, 2009 at 5:07am
There are no actions to perform.  

Matt Siegman 
YaBB Legends (Inactive)
*
Offline
Posts: 3,380
Wichita, KS


None
Re: Optimizing .lng files
YaBB 3 will probably be doing away with language files and supporting internationalization in another way.

All the templates are moving out of the Perl code, and the language doesn't need to be in it either if the templates aren't. We may build a plugin or something for whatever templating system we wind up using.

We need to stop thinking about YaBB 3 with the same mindset as we did with Y1 and Y2. It's not going to be a small upgrade--it's a huge change. Y3 is going to be a major change to the codebase. We can rethink things to make them better, not to keep on using old techniques that don't work as well.
 
-- Matt Siegman 8) Wish List
 
IP Logged  
 Reply #19 - Jun 28th, 2009 at 7:07am
There are no actions to perform.  

cepheid 
Senior Member
****
Offline
Posts: 516


None
Re: Optimizing .lng files
Matt Siegman wrote on Jun 28th, 2009 at 5:07am:
All the templates are moving out of the Perl code, and the language doesn't need to be in it either if the templates aren't.

I'm not quite sure what you mean.  It seems to me that the language isn't "in the code" now, which is why the language files are separate.  Do you simply mean that the language files can be built into the templates, so there will be different templates for different languages?  Or, if not that, then what?  I'm not sure I understand.

It also seems to me that at some point, you're going to need language files, unless you want to template each and every page.  If you have multiple pages that all have similar HTML but different wording (e.g. in the Admin Center, with multiple preference pages), then it seems like the most efficient way to handle that would be with a single HTML template, which therefore necessitates different language files to "fill" the template.

Were you thinking of a different way?

Also, right now my focus is on improving the language in the files - I'm leaving the trimming of duplicates, etc. to later.  The language rewrite is probably needed whether or not these specific files are used later, since the actual language itself would be transfered to the new template.  Trimming the dupes might be futile, though, if the template philosophy changes.
 
WWW  
IP Logged  
 Reply #20 - Jun 28th, 2009 at 2:19pm
There are no actions to perform.  

Matt Siegman 
YaBB Legends (Inactive)
*
Offline
Posts: 3,380
Wichita, KS


None
Re: Optimizing .lng files
Well, we will still use language files, but we should probably consider rebuilding them as we build the code. Improving the wordings of everything is probably a really good idea.

As we implement the 'use strict' coding standard, we will have to update every single language entry to put it in a package namespace so they are referenced something like this: $YLANG::profile{'posts'}.

I was for some reason thinking about language files getting put in the DB, but that's not good since it would be a huge query every time.
 
-- Matt Siegman 8) Wish List
 
IP Logged  
 Reply #21 - Jun 28th, 2009 at 7:50pm
There are no actions to perform.  

deti 
Legacy Dev Team
Development Team
****
Offline
Posts: 2,650
Prien am Chiemsee, Germany


None
Re: Optimizing .lng files
OH Eng wrote on Jun 27th, 2009 at 10:57pm:
One fairly reliable way to find where things are used in the code is to download Notepad++ and use the "Search In Files" plugin.  Note that you will have to use a version other than the most current version, because the most current one does NOT support Search in Files.  I use v4.9.

I use 5.3.1 and it supports it by default. Look into the 3rd Menu ("Search"), 2nd item ("Search In Files"). Wink
« Last Edit: Jun 28th, 2009 at 7:52pm by deti »  
Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
WWW  
IP Logged  
 Reply #22 - Jun 28th, 2009 at 8:22pm
There are no actions to perform.  

OH Eng 
Past Team Members
Documentation Team
Offline
Posts: 4,026
Pensacola, Florida USA


None
Re: Optimizing .lng files
LOL right you are!  Guess they built it in with V.5.  That explains why trying to use the plug-in gives a "this plugin not supported" message.

 
 
OH Eng  
IP Logged  
 Reply #23 - Jun 28th, 2009 at 10:19pm
There are no actions to perform.  

cepheid 
Senior Member
****
Offline
Posts: 516


None
Re: Optimizing .lng files
Matt Siegman wrote on Jun 28th, 2009 at 2:19pm:
we should probably consider rebuilding them as we build the code.

With that I most certainly agree; the structure of the current files is simple, but confusing (in my opinion) and probably not very optimal, since the entire file is loaded even when only a few lines are needed.  Although more work, the files should probably be separated into a "per displayed page" rather than "per Perl file" structure, so that each page display loads only the language entries actually needed.

Matt Siegman wrote on Jun 28th, 2009 at 2:19pm:
As we implement the 'use strict' coding standard, we will have to update every single language entry to put it in a package namespace so they are referenced something like this: $YLANG::profile{'posts'}.

So you are eliminating global variables entirely and moving towards a module-based implementation?  That's certainly better from a strict coding standard, although it will increase the amount of code required (if for no other reason than that the module names have to be used each time a call is made to a separate file) and I don't think it will help performance.  It is a much better coding style, though, and should help maintenance and development... I presume that's why you're doing it?

Matt Siegman wrote on Jun 28th, 2009 at 2:19pm:
I was for some reason thinking about language files getting put in the DB, but that's not good since it would be a huge query every time.

Not necessarily.  If the language load code is modified per above (so that each page loads only the entries needed), then you'd only query for the items needed, not all items.  The query should be relatively small per page.  But, you'd have to still have flat-file Language files, too, for people who can't/don't use mysql.

Actually, putting it into a DB might help with the "load only what's needed" philosophy because you can index each language entry by the page that needs it, and can include multiple page names if the entry is needed by more than one.  The query can then look for records whose "use_page" matches the page being loaded.  The same thing can be done in flat-file, though there the filename itself would be the "index."
 
WWW  
IP Logged  
 Reply #24 - Jun 29th, 2009 at 2:52am
There are no actions to perform.  

Matt Siegman 
YaBB Legends (Inactive)
*
Offline
Posts: 3,380
Wichita, KS


None
Re: Optimizing .lng files
Well, most of the other major boards still use code based language stuff. It's probably better to keep the language stuff out of the DB.

The performance hit due to using a module name would be negligible. The parsing hit will be next to nothing, and the run phase should actually be a little quicker because Perl won't have to go looking for globals.

Also, premature optimization is the root of all evils Smiley
 
-- Matt Siegman 8) Wish List
 
IP Logged  
 Reply #25 - Jun 29th, 2009 at 3:04am
There are no actions to perform.  

cepheid 
Senior Member
****
Offline
Posts: 516


None
Re: Optimizing .lng files
Matt Siegman wrote on Jun 29th, 2009 at 2:52am:
The performance hit due to using a module name would be negligible. The parsing hit will be next to nothing, and the run phase should actually be a little quicker because Perl won't have to go looking for globals.

The parsing is what was worrying me, but you're right that restricting the namespace should actually improve performance, so it'll be wash or a minor improvement.

Matt Siegman wrote on Jun 29th, 2009 at 2:52am:
premature optimization

I deny any such problem! Shocked Wink

But yeah, I know what you mean.  However, there's "premature optimization" and then there's simply "good planning." Smiley  IMHO, always better to have a good plan so that your later optimization is easier... but then, it looks like that's what's being done here anyway, so I'm not worried. Smiley
 
WWW  
IP Logged  
 Reply #26 - Jun 29th, 2009 at 3:58pm
There are no actions to perform.  

Jet Li 
Legacy Dev Team
Development Team
****
Offline
Posts: 6,588
Hong Kong


None
Re: Optimizing .lng files
cepheid wrote on Jun 27th, 2009 at 5:05am:
The first patch is available now:

Done in SVN.

New
Languages/English/Admin.lng
in SVN.
 
...
PM me for YaBB Installation Service
WWW Jet Li 100000788351637  
IP Logged  
 Reply #27 - Jun 29th, 2009 at 4:28pm
There are no actions to perform.  

deti 
Legacy Dev Team
Development Team
****
Offline
Posts: 2,650
Prien am Chiemsee, Germany


None
Re: Optimizing .lng files
@
cepheid
I like you improvements. Many things are much clearer now!!!

Smiley
 
Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
WWW  
IP Logged  
 Reply #28 - Jun 29th, 2009 at 10:35pm
There are no actions to perform.  

OH Eng 
Past Team Members
Documentation Team
Offline
Posts: 4,026
Pensacola, Florida USA


None
Re: Optimizing .lng files
Most are much clearer, nice work.  However a couple previous corrections made to proper names by dropping the capital letters they should begin with were un-done.  Easy fix.
 
Here are proposed changes to latest Admin lng changes:

Note: The feature with Global Announcement boards - permission can be restricted for GMods to view/post/reply via the board permissions and also (for viewing) via the Cat permissions.
Gender restrictions - Both and None are confusing to users.  We really should explain each, not just one of them.

Line  35
From                                             
Code Select All
member groups  


To 
Code Select All
Member Groups 


Line  85
From    
Code Select All
important messaged 


To
Code Select All
important messages 


Line 85
From                                             
Code Select All
every board\'s Message Index 


To
Code Select All
the Message Index 


Line 85
From                                             
Code Select All
No matter how the permissions are set, only Administrators and Global Moderators can start new topics and reply.', 


To   
Code Select All
Only Administrators or (if allowed) Global Moderators may start new topics and reply to topics in a Global Announcement board.', 

 
Line 87
From                                             
Code Select All
moderators/administrators.', 


To
Code Select All
Moderators, and Administrators and Global Moderators (if selected in Admin Center/Forum Settings/Staff options).', 


Line 117
From
Code Select All
'Restrict access by gender:', 


To
Code Select All
'Allow access by gender:', 


Line 118
From
Code Select All
'("None" means no gender restriction)', 


To
Code Select All
'("Both" gives access to M and F; "None" allows access to all even if no gender is given)', 


Line 220
From
Code Select All
'Show who is currently viewing/replying the Topic to:', 


To
Code Select All
'Show who is currently viewing/replying to the Topic:', 


Line 405 and 406:
Capitalize "members" (consistent with 434, 435, and others)
Line 449
From
Code Select All
'by_pass_lock' => 'Select which Staff Members may bypass the lock on threads:<br /><span class="small">This allows the selected members to reply, modify, unlock, delete, etc. within a locked thread.</span>', 


To
Code Select All
'by_pass_lock' => 'Select which Staff Member Groups may bypass the lock on threads:<br /><span class="small">This allows the selected Member Groups to reply, modify, unlock, delete, etc. within a locked thread.</span>', 



 
 
OH Eng  
IP Logged  
 Reply #29 - Jun 29th, 2009 at 11:06pm
There are no actions to perform.  

cepheid 
Senior Member
****
Offline
Posts: 516


None
Re: Optimizing .lng files
OH Eng wrote on Jun 29th, 2009 at 10:35pm:
However a couple previous corrections made to proper names by dropping the capital letters they should begin with were un-done.Easy fix.

I wasn't sure where capitals should and shouldn't be applied.  I'm not very happy with all the proper names (e.g. User, Admin, etc.) because it feels cumbersome, but I understand the desire to separate those identities from the rest of the text.  I'm OK with it, I just don't particularly like it, as a personal opinion - but I won't impose my will on others. Smiley

I also found a number of inconsistencies in multi-word names, e.g. membergroups versus MemberGroups versus Member Groups, etc.  I left those alone for the most part, but they should be made consistent (whether one word or two).

OH Eng wrote on Jun 29th, 2009 at 10:35pm:
'Allow access by gender:',

The reason I used "restrict" is because the default setting is "none," which is confusing (to me) when used with "allow" ... it implies there is no access if no gender is set.  This is actually backwards: if "None" is set, everyone is allowed, while if "Both" is set, members without a gender setting are excluded.  This is why I chose "restrict."

I know you also proposed changing the helper text to make more explicit what "Both" and "None" mean, and that helps, but my personal opinion is that it's more confusing (to me, anyway) with "Allow" versus "Restrict."  It just seems to work better grammatically... access is restricted to Male, Female, or Both... "None" means "no restriction."  If "Allow" were used, "None" wouldn't really make sense... to me.  Just my opinion.

OH Eng wrote on Jun 29th, 2009 at 10:35pm:
'Show who is currently viewing/replying to the Topic:',

Unfortunately this sentence is badly worded either before or after the correction, because "viewing" and "replying" are different verb moods - "viewing" is independent whereas "replying" is dependent.  The final "to" is needed, though, because the selection is whether to show "to" Admins, Mods, all members, etc.  So, I think the final "to" should still be there.

« Last Edit: Jun 29th, 2009 at 11:08pm by cepheid »  
WWW  
IP Logged  
Pages: 1 2 3 4 5
Topic Tools
 

Get Yet another Bulletin Board at SourceForge.net. Fast, secure and Free Open Source software downloads Support This Project BoardMod - YaBB features and templates YaBB Codex - support on installation and usage YaBB Toolbar for your browser

YaBB Facebook Group Page

Vulnerability Scanner

Valid RSS Valid XHTML Valid CSS Powered by Perl
YaBB Chat and Support Community » Powered by YaBB 3.0 Beta!
YaBB Forum Software © 2000-2011. All Rights Reserved.