Language editing inside Wedge

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Language editing inside Wedge
« Reply #45, on February 22nd, 2013, 09:06 PM »
Actually, there is one way it could be used to optimise performance, but it's going to take me a little while to figure out how exactly to do it without more breakages ;)

Right now we load English as a fallback. What occurs to me is that we could load English, load the other language, then the DB query, then cache the result so we wouldn't have duplicate loads for non English languages.

It would also mean that the English UK pack would simply be the changes from the default, and we could expand upon that by having other language packs be able to declare a fallback as well, e.g. Portuguese (Brazil) vs Portuguese (Portugal) if that makes sense.

Is complicated, but should make it possible.
Re: Language editing inside Wedge
« Reply #46, on February 24th, 2013, 03:09 AM »
Meanwhile, here's a picture of a fish.

Or not. ;)

WIP of the new language editing area. Replaces that godawful dropdown we all know and despise that some of us know and have come to hate. For those of you who didn't know about it, fire up SMF, Admin > Languages > select a language > play with the dropdown in the corner.

 langedit.png - 49.39 kB, 966x996, viewed 164 times.

Re: Language editing inside Wedge
« Reply #47, on February 24th, 2013, 09:57 PM »
OK, another update. Probably the last for the evening because I'm at the stage where I'm not entirely sure what to do with it, so throwing it open a bit.

First up, the more finalised list of templates. Aside from the fact everything is now linked to where it should be, the things of note are that I moved Modlog from main to admin panel and gave it a better description, plus I created a block for 'configurable language crap that isn't in this area', namely the email templates and the agreements. I have no qualms about them being outside the language editor, they are where they are for a very good and specific reason, namely that they have a bunch of other specific behaviours that are attached to them that have no place being here.[1]

Then we have the actual editing page itself. You may remember SMF's was a two-pane affair. I didn't like it, still don't like it, and I've started on a half-assed replacement but I'm really not that fond of THAT either. It's just marginally better to me than what we had before. Second screenshot shows the main index, part way down - mostly so it shows the one actual entry I have that does have both a master value and a replaced value (namely 'admin', which is the main $txt['admin'] menu item)

I'm open to any suggestions of what to do with it because I got nothing right now!

 1. Email templates has all the stuff related to variable injections, agreements do not currently but will have the whole 'force reagreement' facility. Either way it's a ton of stuff that is unique to those areas and would get in the way of the rest of the stuff.

 lang_listing_2.png - 54.43 kB, 944x970, viewed 157 times.

 lang_listing_3.png - 41.29 kB, 990x1092, viewed 155 times.

When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,078
Re: Language editing inside Wedge
« Reply #48, on March 1st, 2013, 12:55 PM »
'kay, a few comments on the new area...

- Looks nice :)

- License agreement editor shows 3 line breaks for French even though I only added two br tags. The difference with the English file is, I actually inserted a linebreak before adding the two br tags, so I guess Wedge is converting linebreaks to br's... Is it as intended..? Might as well remove the br's and do two line-breaks per paragraph in the language file.

- Finding the wysiwyg editor in that area is amusing... ;) Cursor over the scrollbar is the editor cursor though, not the regular cursor.. (??) And I just realized it's the same everywhere.. Argh?! Doesn't that bother you..??

- 'Master values' pages could use more styling... I know it's a WIP, but I'm thinking 'Master values' should be in italics.

- Also, err... I'm assuming eventually one will be able to edit these, right..? :^^;:

- Suggesting that the E-mail templates links point to the page for the current language being edited. (It's already in the URL -- lid=french/english.)

- Search engine doesn't work, it redirects to the admin homepage. Reminder: I have pretty URLs enabled... Maybe related. Even the variable separators have ampersands instead of semi-colons... (??!!)

- I forgot... Do you still plan to allow for caching English + French next, or something...? I don't remember.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Language editing inside Wedge
« Reply #49, on March 1st, 2013, 02:21 PM »
Quote
- License agreement editor shows 3 line breaks for French even though I only added two br tags. The difference with the English file is, I actually inserted a linebreak before adding the two br tags, so I guess Wedge is converting linebreaks to br's... Is it as intended..?
The underlying editing code (i.e. the likes of Class-Editor itself, plus stuff like un_preparsecode, un_htmlspecialchars and friends) expects never to deal with line breaks. No post has line breaks in it, because preparsecode strips them and converts to <br>s (and this needs to stay, too)
Quote
- Finding the wysiwyg editor in that area is amusing...
Well, there's no reason not to have it, if the WYSIWYG editor is reliable. I did not do any tests specifically with WYSIWYG, I merely added the correct code and in theory it should work *shrug*
Quote
Doesn't that bother you..??
It would if I ever, ever used the WYSIWYG editor... :whistle:
Quote
- 'Master values' pages could use more styling... I know it's a WIP, but I'm thinking 'Master values' should be in italics.
Well, there's master and current and both could easily be made italic. It's the sort of thing that I got fed up with it for, I didn't really know what to do with the UI going forward.
Quote
- Also, err... I'm assuming eventually one will be able to edit these, right..? :^^;:
Um, yes :lol:
Quote
- Suggesting that the E-mail templates links point to the page for the current language being edited. (It's already in the URL -- lid=french/english.)
What I meant to do was add another layer of linktree to point to the specific template.
Quote
- Search engine doesn't work, it redirects to the admin homepage. Reminder: I have pretty URLs enabled... Maybe related. Even the variable separators have ampersands instead of semi-colons... (??!!)
As per r1961's changelog: "Also note the search function doesn't work yet either." ;) The reason for the form conversion nonsense is because the <form> is literally just <form> at the moment, so not content with the fact there's no backend to search, there's a broken front-end too! But as per r1961, it was because I'd been staring at the code for days that I was just blinded by what I wanted to do with it, you know?
Quote
- I forgot... Do you still plan to allow for caching English + French next, or something...? I don't remember.
It's the plan. It's just a plan at this stage though.

Nao

  • Dadman with a boy
  • Posts: 16,078
Re: Language editing inside Wedge
« Reply #50, on March 1st, 2013, 04:48 PM »
Quote from Arantor on March 1st, 2013, 02:21 PM
The underlying editing code (i.e. the likes of Class-Editor itself, plus stuff like un_preparsecode, un_htmlspecialchars and friends) expects never to deal with line breaks. No post has line breaks in it, because preparsecode strips them and converts to <br>s (and this needs to stay, too)
But apparently, here, it converts them...
Quote
Well, there's no reason not to have it, if the WYSIWYG editor is reliable. I did not do any tests specifically with WYSIWYG, I merely added the correct code and in theory it should work *shrug*
When I say Wysiwyg editor, I simply mean post box, with all smileys etc. I don't use Wysiwyg either, as you well know, so I'd hardly enable it by default... ;)

So, the extra line is in 'normal' mode.
Quote
Well, there's master and current and both could easily be made italic. It's the sort of thing that I got fed up with it for, I didn't really know what to do with the UI going forward.
I dunno, maybe having the Master/Current captions in italics, the actual strings in regular, and if the current version is different from master, show it in bold...? (Like in Firefox's hidden setting page ;))
Quote
What I meant to do was add another layer of linktree to point to the specific template.
Is there a problem in simply updating the link...? :unsure:
Quote
As per r1961's changelog: "Also note the search function doesn't work yet either." ;)
All right then. I tend to overlook the changelog, it reminds me too much that I have to finish translations... :lol:
Quote
Quote
- I forgot... Do you still plan to allow for caching English + French next, or something...? I don't remember.
It's the plan. It's just a plan at this stage though.
It's a bit strange to be in a situation where missing strings are again generating errors... :^^;: (e.g. EmailTemplates.)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Language editing inside Wedge
« Reply #51, on March 1st, 2013, 05:00 PM »
Quote
But apparently, here, it converts them...
textarea takes linebreaks as linebreaks, and the unpreparser converts brs to linebreaks too. There should be no linebreaks in the file.
Quote
When I say Wysiwyg editor, I simply mean post box, with all smileys etc. I don't use Wysiwyg either, as you well know, so I'd hardly enable it by default...
Nah, doesn't bother me. Don't really notice. Mostly related to the exciting and fun custom draggable thing we inherited.
Quote
I dunno, maybe having the Master/Current captions in italics, the actual strings in regular, and if the current version is different from master, show it in bold...?
If it has a current version, it's different from master ;)
Quote
Is there a problem in simply updating the link...?
Yes, it's the wrong thing to do. Each link is supposed to be one level of hierarchy, not repurposing a link that is already present.
Quote
It's a bit strange to be in a situation where missing strings are again generating errors... :^^;: (e.g. EmailTemplates.)
English should still be loaded first though... in all cases, even email templates.

Nao

  • Dadman with a boy
  • Posts: 16,078
Re: Language editing inside Wedge
« Reply #52, on March 17th, 2013, 05:06 PM »
Quote from Arantor on March 1st, 2013, 05:00 PM
Quote
But apparently, here, it converts them...
textarea takes linebreaks as linebreaks, and the unpreparser converts brs to linebreaks too. There should be no linebreaks in the file.
I'm only saying what I'm seeing... :-/
The French language files have linebreaks everywhere. It's just "how they're done". These linebreaks are converted to br's at runtime. It's also much more readable (and easier to manipulate for translators...?), if you ask me, so I'm thinking I'll just use linebreaks for the agreement, rather than br tags, and I'd strongly encourage you do the same on yours.
Quote from Arantor on March 1st, 2013, 05:00 PM
Quote
It's a bit strange to be in a situation where missing strings are again generating errors... :^^;: (e.g. EmailTemplates.)
English should still be loaded first though... in all cases, even email templates.
I didn't follow the recent developments, if any.
Did you end up restoring the 'fallback to English' feature in your cached versions..? Or will I still have empty strings instead of English when a French one isn't translated?

Also, I noticed that a change you made last night with $language broke the default language behavior in Wess, more specifically in how Subs-Cache generates a language string modifier in the filename. My local install has French by default, but since your update, my files are named 'script-m-french-1234.js.gz' instead of just 'script-m-1234.js.gz'... Should I look into it? I haven't yet finished reviewing your $language changes. Lots of things to do on my side... :-/

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Language editing inside Wedge
« Reply #53, on March 17th, 2013, 05:40 PM »
Quote
The French language files have linebreaks everywhere. It's just "how they're done". These linebreaks are converted to br's at runtime. It's also much more readable (and easier to manipulate for translators...?), if you ask me, so I'm thinking I'll just use linebreaks for the agreement, rather than br tags, and I'd strongly encourage you do the same on yours.
WHY are they converted to brs at runtime? They're only converted as far as I can see through the textarea component. Other than that, they should NOT be there.
Quote
Did you end up restoring the 'fallback to English' feature in your cached versions..? Or will I still have empty strings instead of English when a French one isn't translated?
Not yet. It's on my todo list.
Quote
Also, I noticed that a change you made last night with $language broke the default language behavior in Wess, more specifically in how Subs-Cache generates a language string modifier in the filename. My local install has French by default
That is because you need to set $settings['language'] to french, or otherwise set the default language in the admin panel. Right now it's going to be falling back to English because you haven't got it set in the settings table. But your profile still has it set to French anyway which forces it to show you French even if the default is not.

Nao

  • Dadman with a boy
  • Posts: 16,078
Re: Language editing inside Wedge
« Reply #54, on March 19th, 2013, 07:28 PM »
Quote from Arantor on March 17th, 2013, 05:40 PM
WHY are they converted to brs at runtime? They're only converted as far as I can see through the textarea component. Other than that, they should NOT be there.
The agreement..?
Register.php
loadLanguage('Agreement');
$agreement = parse_bbc($txt['agreement']);
Or something to that effect...
So, it's converting newlines to br's. Thus, you have to choose between a HTML string (English version), or a BBC one (French version)... Which one do we get..? I vote for BBC.
Quote
That is because you need to set $settings['language'] to french, or otherwise set the default language in the admin panel.
Hadn't done it, indeed. ;)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Language editing inside Wedge
« Reply #55, on March 19th, 2013, 07:45 PM »
Quote
So, it's converting newlines to br's.
Um... no, it's not.

The registration page for French has each paragraph separated by two line breaks. Which is what's in Agreement.french.php. parse_bbc has precisely squat to do with dealing with line breaks. The extra line break is introduced by the editor component when it un_preparses the brs back into line breaks so there are now 3 line breaks.
Quote
Thus, you have to choose between a HTML string (English version), or a BBC one (French version)... Which one do we get..? I vote for BBC.
And if you look back at what I said, I explained how I generated the string I did. IT IS BBC. I copied it from the old agreement.txt file into a post, saved it, and extracted the raw content from the DB. preparsecode does the nl2br conversion, it always has done.

If you want the bbc version, look to the English one because that's the 'correct' one. Look at the source for every post - you will not find newlines in general bbcode, because that's how it's always been done. Even down to how the news item does its thing - the newline is the separator between items, with the actual item having had nl2br conversion.

And parse_bbc adheres - it does no such conversion of newlines to bbc. I am not entirely sure why it is done this way around but it is how it has always been.