[wp-trac] [WordPress Trac] #45530: Fallback to loaded translations when .json files with translated strings do not exist

WordPress Trac noreply at wordpress.org
Fri Dec 7 20:28:41 UTC 2018


#45530: Fallback to loaded translations when .json files with translated strings do
not exist
--------------------------+-----------------------------
 Reporter:  dimadin       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:  5.0
 Severity:  major         |   Keywords:  has-patch
  Focuses:  javascript    |
--------------------------+-----------------------------
 In #45103, JavaScript translation support was added so it loads .json
 files for them. But there are few problems with this.

 You need to download those files from WordPress.org API, and there are
 conditions to match in order to both generate them there and be able to
 download from it.

 Another thing is that it breaks workflow that existed since start of i18n
 in WordPress. Since PO/MO files were used, you could work with PO and
 immediately see results. This is useful when, for example, you translate.
 It is not simple to replicate this. There is npm package to convert to
 JSON, there is WP-CLI command released two days ago, but both tools are
 complicated for setup and use by average translator, and even then add
 unnecessary step.

 Finally, if for whatever reason .json files are not there or there is a
 problem with their loading, there would be no translations.

 Attached patch is based on work for Gutenberg plugin. Idea is that if
 normal loading fails for whatever reason, it uses standard translations
 for that domain.

 It still doesn't have any filtering here, but I think that it should have
 one since other, standard method for loading translations does have one.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45530>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list