WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#48776 closed defect (bug) (fixed)

Empty "Continue" Buttons in install process

Reported by: derweili Owned by: SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: normal Version: 4.0
Component: Upgrade/Install Keywords: has-patch
Focuses: javascript Cc:

Description

When installing WordPress the first step is to select a Language. When selecting a language the "Continue" button instantly changes its text to the translation of "Continue" in the selected language.

For some languages which do not have a translation of "Continue" no fallback is used. Instead the Button is Empty.

This happens for following Languages (Language Codes)

  • as
  • dzo
  • rhg
  • tah

Some other Languages like "azb" are using the english version als fallback.

All available Languages are loaded from this api Endpoint:
http://api.wordpress.org/translations/core/1.0/

The data from the api contains following information

  {
    "language": "dzo",
    "version": "4.7.2",
    "updated": "2016-06-29 08:59:03",
    "english_name": "Dzongkha",
    "native_name": "རྫོང་ཁ",
    "package": "http://downloads.wordpress.org/translation/core/4.7.2/dzo.zip",
    "iso": {
      "1": "dz",
      "2": "dzo"
    },
    "strings": {
     "continue": ""
    }
  },

The continue field which is used for the continue button is empty.

Attachments (2)

48776.patch (461 bytes) - added by sathyapulse 3 months ago.
48776.patch
48776.1.patch (3.0 KB) - added by sathyapulse 3 months ago.
The patch addresses the problem in the server side and refactors the existing code to remove duplicates.

Download all attachments as: .zip

Change History (12)

#1 @ocean90
3 months ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 5.3 to 4.0

In language-chooser.js, the line which overrides the value attribute could be changed to value: option.data( 'continue' ) || 'Continue',

@sathyapulse
3 months ago

48776.patch

@sathyapulse
3 months ago

The patch addresses the problem in the server side and refactors the existing code to remove duplicates.

#2 @tobifjellner
3 months ago

I have now temporarily patched this problem "from the other side" by "translating" the missing strings to "Continue" for the four locales mentioned above.

A stable solution of this problem could perhaps more nicely be made by fixing the output of the api (which would be a fix in meta). The good thing about that approach is that one fix would automatically correct the problem also for recent versions of WordPress core.

#3 @tobifjellner
3 months ago

I have opened a corresponding Meta ticket: https://meta.trac.wordpress.org/ticket/4872
If that one is accepted by the Meta team, then this ticket could be closed as "Reported upstream".

#4 @SergeyBiryukov
3 months ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

I think fixing this on both core and API side wouldn't hurt :)

#5 @afercia
3 months ago

The reply on the meta ticket doesn't seem to share the idea this issue should be fixed also on the API side. I'd tend to agree a general fallback mechanism should be in place. Not sure it necessarily needs to be done in the API (as it sounds like it would be outside of the scope of an API from a "purist" perspective).

However, instead of just closing the meta ticket I'd tend to think this issue should be considered a bit more in depth in a broader discussion.

#6 @ocean90
3 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 46784:

Upgrade/Install: Provide a default label for "Continue" button in language selection form.

Prevents an empty continue button if a translation isn't yet available.

Props sathyapulse.
Fixes #48776.

#7 @sathyapulse
3 months ago

@ocean90 Could you please let me know why patch was not applied as it is? It contains the code refactoring as well. Do you want me to create it as a separate ticket?

#8 follow-up: @ocean90
3 months ago

There's currently no need for code refactoring here. The function is only used during the initial installation and not intended to be used for other use cases. To keep the change as small as possible I went with the simplified version of your fallback approach in PHP instead of JavaScript.

#9 @sathyapulse
3 months ago

@ocean90 Do you recommend to create a new ticket for refactoring to improve the quality of code? I understand that it's used only once during installation but it would be better to improve the quality.

#10 in reply to: ↑ 8 @SergeyBiryukov
3 months ago

Replying to ocean90:

To keep the change as small as possible I went with the simplified version of your fallback approach in PHP instead of JavaScript.

Per the latest PHP Coding Standards Changes, the short ternary operator must not be used.

Should we rewrite [46784] to replace the operator or reconsider the standards?

Note: See TracTickets for help on using tickets.