New revs - Public comments

TE

  • Posts: 286
Re: New revs - Public comments
« Reply #195, on October 9th, 2011, 12:37 PM »
Quote from Nao on October 6th, 2011, 02:58 PM
Similarly, every time we change the name of an SMF variable (from $modSettings and $settings, I mean), we should ensure it's also reflected in the import tool.

Thorsten, do you keep track of these...?
Haven't checked yet, but shouldn't be a big problem..
Thorsten "TE" Eurich - Former SMF Developer & Converters Guru

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #196, on October 9th, 2011, 12:38 PM »
With the changes to user, I had to specify a parameter (error type is param 2, sprintf vars is parameter 3). Where the type was specified I was fairly sure I'd got it right and where it wasn't specified (and thus it would be logged as general), I changed it, at the time it seemed more logical to flag it as a user error rather than a general error. It's not a general error in processing, it's because the user has done something wrong - and that to me makes more sense to flag as a user error.

Yes, Core Features is buggy and has been for some time due to an extra hide class in the template but as Nao says I'm looking to do away with it in due course so it's not like I've been worried about fixing it.

And I thought I'd fixed all the brackets but I guess I missed a couple :(
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,082
Re: New revs - Public comments
« Reply #197, on October 9th, 2011, 01:37 PM »
Pete, did you actually translate the new English strings to French? :lol:
Did you use a tool, or your own memories of the French language?

Well it's not perfect but I find it endearing to see you try ;)
Quote from Arantor on October 9th, 2011, 12:38 PM
With the changes to user, I had to specify a parameter (error type is param 2, sprintf vars is parameter 3). Where the type was specified I was fairly sure I'd got it right and where it wasn't specified (and thus it would be logged as general), I changed it, at the time it seemed more logical to flag it as a user error rather than a general error. It's not a general error in processing, it's because the user has done something wrong - and that to me makes more sense to flag as a user error.
If that's not an oversight, then that's fine with me ;)
Posted: October 9th, 2011, 12:58 PM

(Bump!)
Quote from Nao on October 9th, 2011, 11:28 AM
Pete -- there are so FEW fatal_error() calls left, I think it'd make sense to actually rename them to fatal_error_hardcoded() or something (who cares), and rename fatal_lang_error() to fatal_error()...
Posted: October 9th, 2011, 01:09 PM

In fatal_lang_error, we have this at some point:

   updateOnlineWithError($error, true, $sprintf);

At this point, $error is still the key to the $txt string, not the string itself. I'm changing this to $txt[$error], is it okay? (I suppose you're more acquainted to the Errors.php file than I am right now.)

Also, maybe we could simply remove fatal_error() and use the fatal_lang_error codepath all the time... I mean, if $txt[$error] isn't set, it simply shows $error... In both situations. (Well, it'd need some tweaking in fatal_lang_error though.)
Posted: October 9th, 2011, 01:20 PM

Any reason for removing the (strpos($str, '%p') !== false) test in Subs.php? (Not that I mind... :P)

Phew, only 600 lines left to check and I'll be 100% up to date with the newest rev... Yippie!
Posted: October 9th, 2011, 01:23 PM

index.language.php has:

$txt['merge_confirm'] = 'Are you sure you want to merge';
$txt['with'] = 'with';

I suspect the two are mixed together... And anyway, I couldn't find 'merge_confirm' used anywhere else. There's not even a single 'confirm' in SplitTopics.template.php... :-/
I'd remove these immediately (index language, hey! Waste of time!), but... $txt['with'] might be seen as 'important' for modders. So I'm at least asking whether there are objections to me deleting these ;)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #198, on October 9th, 2011, 02:06 PM »
I used a mix of my own memory and Google Translate when my memory failed me. I knew it probably wasn't perfect but I figured I'd give it a shot, and while I haven't had time to check the fixed translation, I'm willing to bet that not having 'here' in a separate string (for example) allows for better translation.

No, it shouldn't be $txt[$error] passed to the update counter, it should be the $error on its own - the second parameter indicates where it came from, false for fatal_error, true for fatal_lang_error, because it deliberately doesn't stuff the entire message into the online table if it doesn't have to.

The removal of the %p test in Subs... At the time I concluded it was redundant; the only language that I'm aware of that uses AM/PM in a 12-hour context is English, and I don't know any other language that prefers a 12 hour context over a 24 hour one. I can reinstate it but frankly I'd rather push English to 24 hour before I supported 12 hour more...

Where else is $txt['with'] used? If it's not used anywhere, remove it. Also check for merge_ on its own, strings get compounded a lot in the code.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #199, on October 9th, 2011, 02:17 PM »
Okay, I'm finished with the review... Well, not completely, but I have committable material.
It's going to be a relatively big one, and I have to go for now, I hope to have it up and running within an hour.
Quote from Arantor on October 9th, 2011, 02:06 PM
I used a mix of my own memory and Google Translate when my memory failed me. I knew it probably wasn't perfect but I figured I'd give it a shot, and while I haven't had time to check the fixed translation, I'm willing to bet that not having 'here' in a separate string (for example) allows for better translation.
Definitely (although in French, it's not going to change anything.)
I also merged two strings for the same reason ('not_removed' error string.) Next commit.
Quote
No, it shouldn't be $txt[$error] passed to the update counter, it should be the $error on its own - the second parameter indicates where it came from, false for fatal_error, true for fatal_lang_error, because it deliberately doesn't stuff the entire message into the online table if it doesn't have to.
Okay, to save space... Good to know. As long as it's decoded back into $txt[$error] on the other side of the log viewing code... ;)
Still, what do you think of merging them?
Quote
The removal of the %p test in Subs... At the time I concluded it was redundant; the only language that I'm aware of that uses AM/PM in a 12-hour context is English, and I don't know any other language that prefers a 12 hour context over a 24 hour one.
I don't know either but I'm no specialist... Actually, in France, orally we use "5pm/5 o'clock" a lot, just like you British lot will say "teatime", we'll say "le quatre heures" (the 4pm). i.e. what we eat at teatime.
Now, with that said -- it's only oral, rarely written, because we don't have "pm" or "am", so we'll write "il est 20h" but we'll often say "il est 8h" and depending on the day time, it'll obviously mean 8h du matin (8am) or 8h du soir (8pm). There are also people, like me, who have a problem using *anything* else than military time. This morning, my girlfriend asked me for the time. I said "il est 11 heures 45". She replied, "why don't you just say midi moins le quart ?" (midi moins le quart = a quarter to noon.) I guess that's a problem with me mainly... Or because we geeks like to be precise. So the 2400 format is a blessing.
Quote
I can reinstate it but frankly I'd rather push English to 24 hour before I supported 12 hour more...
Do... Do you mean you actually removed support for am/pm entirely?! Really? (I like the idea... It's quite bold :lol:)
Quote
Where else is $txt['with'] used?
Nowhere...
Quote
If it's not used anywhere, remove it. Also check for merge_ on its own, strings get compounded a lot in the code.
I know, with strings like _desc or _info you have to be careful... But I just couldn't find anywhere the confirmation code for merging topics.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #200, on October 9th, 2011, 02:28 PM »
Quote
As long as it's decoded back into $txt[$error] on the other side of the log viewing code...
The log itself doesn't make use of it. The point is to log the error into the users online log, so if a user hits a fatal error while trying to do something (ostensibly something they shouldn't), admins will be able to see that error from Who's Online.

So, if a user tries to read a topic they can't access, the usual "Reading <topic>" will appear in Who's Online, with a little warning icon whose tooltip is the error. It was the cleanest way I could think of to solve the problem of "hey, I think my forum is broken, users can see topics in private boards" because when it looks up the list, it only looks at what the user is requesting, not whether the user has permission.

I don't really have a problem with merging them, provided that we don't break anything else.
Quote
I don't know either but I'm no specialist.
Remember that AM/PM support was very late in the day, not only as a fix but as a report. It can't be that big a problem. It would be interesting to see what languages actually have updated $txt['am'] and $txt['pm'].
Quote
Really?
Support is very limited. All it does is search for %p, work out whether it's AM or PM and substitute in the relevant $txt item. Since I removed the $txt items and the test... it is all gone. Basically it just brings us back to around 2.0 RC4 - but the language itself now dictates what format to use, rather than a language independent version set by the admin.
Quote
Nowhere...
Kill it. If it isn't being used, get rid of it, pure and simple.
Quote
But I just couldn't find...
Yeah, there are a lot of funny strings, often unexpectedly not clearly being mashed together, but that needs to be straightened out. There is, in fact, a bug report about this sort of thing in SMF where the board index has a big fact composite string that's wrong in just about every language other than English.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #201, on October 12th, 2011, 04:25 PM »
Regarding the latest few commits... Wouldn't it make sense to have a function like, 'complex_string', whose purpose would be to do the common string replacements? (boardurl, scripturl...)
It wouldn't be as fast, though. But from the moment you implemented {variables}, I suppose it mattered less than having a non-dynamic list of text strings.
Quote from Arantor on October 9th, 2011, 02:28 PM
Remember that AM/PM support was very late in the day, not only as a fix but as a report. It can't be that big a problem. It would be interesting to see what languages actually have updated $txt['am'] and $txt['pm'].
I totally forgot that this was recent, indeed...
I don't even know why people would need to translate this, meh.

Oh, and so... What about this %Y problem?
We *could* do it in a complicated way, such as {, %Y} where everything between {} would be removed if %Y is empty, but we'd need to apply this to all occurrences, which isn't cool... (Well, of course we could simply integrate the removal in the same code that gets rid of %Y in the first place.)

$show_today = str_replace(' %Y', '', $user_info['time_format']);

->

$show_today = preg_replace('~,? %Y~', '', $user_info['time_format']);
or
$show_today = str_replace(array(', %Y', ' %Y'), '', $user_info['time_format']);

(The second one is faster. strtr() has similar performance, can be 10%-20% faster or slower, totally randomly.)

Or simply remove the comma entirely..?
I really like not having the year when it's a recent post... It's halfway between hardcoded and dynamic dates. And it saves precious space.
Quote
Support is very limited. All it does is search for %p, work out whether it's AM or PM and substitute in the relevant $txt item. Since I removed the $txt items and the test... it is all gone. Basically it just brings us back to around 2.0 RC4 - but the language itself now dictates what format to use, rather than a language independent version set by the admin.
Definitely better...
Quote
Quote
Nowhere...
Kill it. If it isn't being used, get rid of it, pure and simple.
We could also kill $txt['by']... Either do $txt['by_person'] = 'by %1$s', or a series of more strings that would allow for 'by <strong>%1$s</strong>', etc...
Dunno.
It's just that in Japanese, the 'by' is usually shown after the name. But I think it can be put before the name as well, if needed. It just doesn't feel as natural. (And yeah, I know, even SMF doesn't have a Japanese version... But Kyôdai Mahjongg does :P)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #202, on October 12th, 2011, 04:36 PM »
Quote
Regarding the latest few commits... Wouldn't it make sense to have a function like, 'complex_string', whose purpose would be to do the common string replacements? (boardurl, scripturl...)
It would indeed be slower, though I'd suspect it would be much more convenient to use something like <we:script> and replace it in the buffer at the end. It would certainly avoid juggling the variable about so much.

For other stuff like $boardurl, I wouldn't bother, it's just not used enough. But for $scripturl, there is a practical convenience vs performance decision to be made.
Quote
I totally forgot that this was recent, indeed...
I don't even know why people would need to translate this, meh.
It's not so much that some people need to translate it, it's more than some languages simply have no concept of am/pm, and use 24 hour systems instead. In fact, I think it is a peculiarity of English the more I read up on it.
Quote
Or simply remove the comma entirely..?
I really like not having the year when it's a recent post... It's halfway between hardcoded and dynamic dates. And it saves precious space.
Hmm, I'm not actually that fussed personally. I'd say that whatever is reliably going to strip it without leaving too much fluff is fine.
Quote
We could also kill $txt['by']
I want to. I just haven't gotten round to it yet because it's used in a lot of places, just as $txt['in'], $txt['on'] and similar joining clauses are. I'd rather strip them all and use properly constructed phrases, even if it is slower.
Quote
t's just that in Japanese, the 'by' is usually shown after the name. But I think it can be put before the name as well, if needed. It just doesn't feel as natural. (And yeah, I know, even SMF doesn't have a Japanese version... But Kyôdai Mahjongg does
http://download.simplemachines.org/?smflanguages disagrees with you.

What would really help is if I could talk to people who know more languages; ideally I'd like to speak to people who know Chinese, Russian and Arabic. While I'm aware it's a gross simplification, Japanese, Chinese, Russian and Arabic between them hit up all the key problems in the language files.

Internationalisation is an incredibly complex art, and if I'm honest it's not one I'm that familiar with, but I'd like to think that my gut instinct on the practicalities of it are serving Wedge well.

For example, I'm aware of the whole use of : in strings in the admin panel and other places. My gut instinct tells me that they should be in the language file, not the template, because from my understanding of RTL and the way it's currently handled, you'd risk ending up with <setting> <string>: rather than the more correct <setting> :<string>. But I don't know any RTL languages, my knowledge of French is limited and rusty, my knowledge of other languages even more so (but it's enough to recognise that the constructions used currently do not work consistently outside English)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #203, on October 12th, 2011, 09:13 PM »
Quote from Arantor on October 12th, 2011, 04:36 PM
It would indeed be slower, though I'd suspect it would be much more convenient to use something like <we:script> and replace it in the buffer at the end. It would certainly avoid juggling the variable about so much.
I don't know... We'd only need to call complex_string on strings that we KNOW to have variables in them. In effect, it doesn't represent a lot of strings. Thus, calling a preg_replace on every page will probably eat more time than this, I'd think. Although a page-wide buffer could OTOH allow us to use {scripturl} directly in strings in the template, and thus save us from globalling it... Dunno, it could warrant some performance tests.
Quote
It's not so much that some people need to translate it, it's more than some languages simply have no concept of am/pm, and use 24 hour systems instead. In fact, I think it is a peculiarity of English the more I read up on it.
According to Wikipedia, English isn't the only one, and Greece has strings for it (π.µ. and µ.µ.). In the Philippines, one of the local languages has 'sb' and 'sg'. Japanese has its own -- gozen/a.m. 午前 and gogo/p.m 午後, but they're shown before the hour, not after. Same for Chinese. Heck, IIRC Japanese even has additional words like 'deep night'...
http://en.wikipedia.org/wiki/12-hour_clock
I'd tend to say that it's up to the server to translate that to the current locale.
Quote
Hmm, I'm not actually that fussed personally. I'd say that whatever is reliably going to strip it without leaving too much fluff is fine.
I can only think of one solution... Introduce a $txt['time_format_this_year'], with the simplified time format, and use it accordingly in timeformat() when required.
I'll be working on that...I'm surprised... I didn't remember anything about that. I've been on many, many Japanese forums. A large majority uses 2ch-derived crap. A small minority uses Western forum boards, mostly vBulletin IIRC. I have yet to see a single Japanese forum using SMF. And I do mean a forum in Japanese, maintained by Japanese people.
Quote
What would really help is if I could talk to people who know more languages; ideally I'd like to speak to people who know Chinese, Russian and Arabic. While I'm aware it's a gross simplification, Japanese, Chinese, Russian and Arabic between them hit up all the key problems in the language files.
Well, my knowledge of Japanese (not fluent but I can read it just fine) would definitely be helpful here, when it comes to modifying our code so that it helps the Japanese version feel more natural.
Quote
Internationalisation is an incredibly complex art,
...And normally the job of an internationalizer. But apparently, at SMF, that job consists in making sure that the various language packs are returned in time... It doesn't even require speaking English correctly. :P
I speak French and English. I have a good knowledge of Japanese and Spanish. I can read some Italian (well, didn't learn it, but it's not very hard for a French :P). That's all I can say about myself. I'm a bit old to be learning any other language ;) Oh yes, I read a bit of Chinese, too. But that's only because common traditional hanzi and kanji are identical... Wo bu shi zhongguoren.
Quote
For example, I'm aware of the whole use of : in strings in the admin panel and other places. My gut instinct tells me that they should be in the language file, not the template, because from my understanding of RTL and the way it's currently handled, you'd risk ending up with <setting> <string>: rather than the more correct <setting> :<string>. But I don't know any RTL languages, my knowledge of French is limited and rusty, my knowledge of other languages even more so (but it's enough to recognise that the constructions used currently do not work consistently outside English)
Hmm... I don't know any RTL language so I can't really speak on this matter.
Additionally, I haven't tested Wedge in RTL mode for a VERY long time... :-/

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #204, on October 12th, 2011, 09:33 PM »
Quote
We'd only need to call complex_string on strings that we KNOW to have variables in them. In effect, it doesn't represent a lot of strings.
$scripturl is the special case, because it's used in a ton of strings as well as throughout the source.

Things like boardurl are rare enough that you can just do a str_replace as needed; no need to wrap it in a special function.

But it doesn't require a page wide regex, just a page wide str_replace as it's constant and source level.
Quote
I'd tend to say that it's up to the server to translate that to the current locale
Yup. I seem to recall setting up a setlocale call for that purpose, assuming LC_TIME or LC_ALL is still passed. Again this is something I'd like more input because I don't know about other languages and cultures.


Oh, and last I heard, the i18n team is now called Localizers, which isn't really much better, and while I do remember debates about languages, I don't remember much strong debate about how to practically approach these matters, almost as if they were just accepted as faults that weren't going to be fixed. IIRC, the only reason the AM/PM thing happened was because a real[1] team member kicked up a fuss.


Lastly, I wouldn't worry about RTL too much at this time.
 1. The Internationalizers/Localizers have never been considered a real team, even if some tried to treat them as valuable equals. In all honesty I think Akyhne has more power as a consulting dev than he did as Lead Internationalizers.

Re: New revs - Public comments
« Reply #205, on October 12th, 2011, 10:01 PM »
Translating software into Finnish can be a major pain in the a**, mostly because of the fusional nature of the language. If the software uses a single word in several different places the translation might be a bit problematic.

Simple example: the words "your", "users" and "password" are defined separately in language files. If you translate the words into Finnish as they would be used in a phrase "your password", the output is a bit different than what a phrase "users password" would require.

Your password = Sinun salasanasi (or you can just use "Salasanasi", as the -si ending here says it already)
Users password = Käyttäjän salasana (no ending used for the password, or "salasana")

This is problem only if the language items are broken into small pieces. If the items in the language files are full phrases or their use is limited to singular places, the translation can be exact (or at least appear to be decent).

Anyway... I offer myself as volunteer for the Finnish localisation effort when the time comes for that line of work.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #206, on October 12th, 2011, 10:39 PM »
@stackmouse> I remember when I had to ask the SMF team for a $txt['reply_noun'] as opposed to just $txt['reply'] because they used the same string both as a verb and a noun ('reply number 1' / 'reply to this message'), even when most languages don't use the same word for both...
Quote from Arantor on October 12th, 2011, 09:33 PM
$scripturl is the special case, because it's used in a ton of strings as well as throughout the source.
Well, then we could consider doing that str_replace on the buffer yeah, I guess...
Posted: October 12th, 2011, 10:17 PM

Okay, did it... I'm a bit disappointed by the low number of replacements this saves us from doing. It's mostly stuff in the Who language files (determineAction)... But it's so fast to do (I think a hundredth of a millisecond), it's not worth worrying about -- especially since there'll ALWAYS be a {scripturl} to replace, given that they're being used in the main macros.
Posted: October 12th, 2011, 10:35 PM

Oh, and maybe we could also use that for the quote tag. If you look into install.sql, {{scripturl}} is being used, and then replaced in Subs-BBC.php with $scripturl.

And now I just realized a problem...
What if users actually type {scripturl} in their posts...?!?!

(Good thing I committed this as a stand-alone commit, so that we can easily revert it...)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #207, on October 12th, 2011, 10:50 PM »
@stackmouse, this is exactly we've done work on it lately, compounded strings are workable in English but no other language.

@Nao, that's why I suggested doing it with a <we> variable ;) it won't ever be used in posts directly.

But if it's a global replace, you can replace any instance of scripturl throughout the entire source, except for its definition in QueryString, and the actual replace itself.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #208, on October 12th, 2011, 11:28 PM »
Quote from Arantor on October 12th, 2011, 10:50 PM
@Nao, that's why I suggested doing it with a <we> variable ;) it won't ever be used in posts directly.
Why not..?
Do you think {scripturl} is likelier to be used in a post? Well, if it's used, it's only to explain users what it's for, or post code samples etc... <we:script> would be in the same situation, wouldn't it? (Also, it would be caught by the macro replacement code AFAIK...)
Quote
But if it's a global replace, you can replace any instance of scripturl throughout the entire source, except for its definition in QueryString, and the actual replace itself.
QueryString....?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #209, on October 13th, 2011, 12:08 AM »
Quote
Why not..?
Do you think {scripturl} is likelier to be used in a post? Well, if it's used, it's only to explain users what it's for, or post code samples etc... <we:script> would be in the same situation, wouldn't it? (Also, it would be caught by the macro replacement code AFAIK...)
It's likely to be used if someone posts code. <we:*> on the other hand won't be caught by the replace filter because it'll have been converted to entities and thus the raw form is never exposed to the replacer.
Quote
QueryString....?
Isn't QueryString.php where $scripturl is first defined?