Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostics strings - translate or not? #1118

Closed
petecooper opened this issue Jan 20, 2018 · 17 comments
Closed

Diagnostics strings - translate or not? #1118

petecooper opened this issue Jan 20, 2018 · 17 comments
Assignees
Labels
Milestone

Comments

@petecooper
Copy link
Member

@petecooper petecooper commented Jan 20, 2018

See Uli's forum post for background: https://forum.textpattern.io/viewtopic.php?pid=308766#p308766 and @philwareham's follow-up request: https://forum.textpattern.io/viewtopic.php?pid=308778#p308778

I'm biased as an English speaker, but I am +1 for leaving them purely in English.

@bloatware

This comment has been minimized.

Copy link
Member

@bloatware bloatware commented Jan 20, 2018

These are not translated anymore and go into mode.ini file.

Edit: err, unless I confound diagnostics and error messages, then it's more complicated, since some of the diagnostics strings are probably used elsewhere.

@uli-on

This comment has been minimized.

Copy link
Contributor

@uli-on uli-on commented Jan 20, 2018

These are certainly those strings appearing in the preflight check section on the Diagnostics page. Those should be duplicated when diagnostics strings remain in English, they're directed at the user.

@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 20, 2018

Only some of the diagnostic strings are used in the <textarea> report - those would have to be ascertained and the moved to the mode.ini file under a different group name I guess. @Bloke whats your take in this?

@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 22, 2018

I'm keen to get this done before 4.7 beta if it needs doing. If some of the diagnostics strings can be left in English (basically, the strings that appear in the preflight check textarea) then that reduces the amount of work translators need to do, and makes the preflight report understandable by the wider community.

I would need to know:

  1. A list of gTxt() strings that are only used in preflight report (probably quite easy to ascertain from diag.php)
  2. What the group name would be for these new strings when put into the mode.ini file (i.e. can it still be [diag] group there or another name entirely?)

Then, obviously, one of you PHP guys would need to amend the code so that these strings are read from the correct location.

@Bloke

This comment has been minimized.

Copy link
Member

@Bloke Bloke commented Jan 22, 2018

This is a good idea. A list of gTxt strings is easy to scrape from pre-flight, as you say. As for the group name, sticking it under [diag] should work if we go with code like this:

function load_lang($lang, $events = null)
{
    global $production_status, $event;

    $textarray = Txp::get('\Textpattern\L10n\Lang')->load($lang, $events);

    if ($lang == LANG
        && ($production_status !== 'live' || $event === 'diag')
        && @$debug = parse_ini_file(txpath.DS.'mode.ini')
    ) {
        $textarray += (array)$debug;
        Txp::get('\Textpattern\L10n\Lang')->setPack($textarray);
    }

    return $textarray;
}

Untested.

@philwareham philwareham added this to the v4.7 milestone Jan 22, 2018
@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 22, 2018

@Bloke OK, I've opened a separate branch for this work. I can also take the opportunity to reword some of the diagnostic string names so there is some consistency. I'll let you know when the strings are in mode.ini and maybe you can do the PHP side of it?

@Bloke

This comment has been minimized.

Copy link
Member

@Bloke Bloke commented Jan 22, 2018

No worries. Should be a simple case of swapping out the load_lang() function in txplib_misc.php with the version I posted above. Feel free to test if you like.

philwareham added a commit to textpattern/textpacks that referenced this issue Jan 22, 2018
@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 22, 2018

@Bloke I've done all the Textpack work for this now. Just need you to put your code example into wherever and give it a quick test, then we can merge into dev.

That'll be 26 strings that translators don't need to worry about again! :)

@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 22, 2018

Seems to already read these new texts from mode.ini in my tests without adding additional code?!

@Bloke

This comment has been minimized.

Copy link
Member

@Bloke Bloke commented Jan 22, 2018

They're probably still in your lang table. Need to remove english and try again?

@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 22, 2018

I'd already wiped the English and done that. Definitely reading the strings from mode.ini without additional code.

@Bloke

This comment has been minimized.

Copy link
Member

@Bloke Bloke commented Jan 22, 2018

Weird, it's not for me. It works with the new code in English, but when I switch to a language other than that, I get untranslated strings for some reason, even though it loads the mode.ini. I think it's to do with the tests or the fact it's not injecting them in the right area. Will test more thoroughly later.

@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 22, 2018

Works fine for me - wiped English from the database tables, installed Spanish only and I get this (which is correct as far as I can see)...

grab

@Bloke

This comment has been minimized.

Copy link
Member

@Bloke Bloke commented Jan 22, 2018

And it works even if you put your site in Live mode and also install English, but set the admin-side language to Spanish? Wonder why I'm getting odd results...

@philwareham

This comment has been minimized.

Copy link
Member

@philwareham philwareham commented Jan 22, 2018

Oh, you're right - once the site is in Live mode the strings are missing. Sorry.

@Bloke

This comment has been minimized.

Copy link
Member

@Bloke Bloke commented Jan 22, 2018

Okay, definitely more testing required. I'll get it working.

@Bloke

This comment has been minimized.

Copy link
Member

@Bloke Bloke commented Jan 22, 2018

Should be fixed in 870868d.

@Bloke Bloke closed this in 870868d Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.