Skip to content

Conversation

@akirk
Copy link
Member

@akirk akirk commented May 2, 2023

What?

Moves the glossary markup to the client side. There is a very small delay in displaying the glossary markup now.

Why?

Equipping all originals with the glossary markup server side is expensive.

How?

Moves the glossary markup to the client side via a REST call. Also re-instates the use of getOriginalHtml() which has plural handling (was removed by accident in #1612).

Testing Instructions

Import a glossary as per #1612 and translate an original that should have markup.

Screenshots or screencast

glossary-rest

@akirk akirk requested a review from trymebytes May 2, 2023 13:10
@akirk akirk force-pushed the local-glossary-rest branch from 5ca4804 to 66feed5 Compare May 2, 2023 19:04
Copy link
Contributor

@trymebytes trymebytes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it works well. Thank you for adding glossary markup for plurals too!

@akirk akirk requested a review from trymebytes May 3, 2023 09:04
@akirk akirk merged commit c78f7a2 into local May 4, 2023
@akirk akirk deleted the local-glossary-rest branch May 4, 2023 11:29
akirk added a commit that referenced this pull request Jul 21, 2023
* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting
akirk added a commit that referenced this pull request Jul 25, 2023
* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting
akirk added a commit that referenced this pull request Aug 3, 2023
* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting
amieiro added a commit that referenced this pull request Aug 18, 2023
* Add the backend with settings and a list with local items (core, plugins, themes)

* Save the checkbox value to enable local translations

* Add a message to hide the local translations if you have not enable them

* Add the originals and the translations strings for the core

* Split the translate_core method in smaller methods

* Add the 4 WordPress core subprojects and the main project.

* Add the functionality to translate locally a plugin

* Add the functionality to translate locally a theme

* Redirect to the selected plugin or theme, not to the main project

* Add the nonces in the URL and their checks

* Add some checks

* Download the .po and .mo files from translate.w.org if they don't exist locally

* Redirect to the locale in the plugins and themes

* Check if the file downloaded from DotOrg has fired an error

* Add the local "languages" folder inside the plugins and themes to look for .po files

* Get the error if I can not find the project

* Split the WordPress core in 4 subprojects

- Development
- Continents and cities
- Administration
- Network admin

* Create the project if I can't find the file with originals and/or the translations strings

* Local inline translation (#1573)

* Add the backend with settings and a list with local items (core, plugins, themes)

* Save the checkbox value to enable local translations

* Add a message to hide the local translations if you have not enable them

* Add the originals and the translations strings for the core

* Split the translate_core method in smaller methods

* Add the 4 WordPress core subprojects and the main project.

* Add the functionality to translate locally a plugin

* Add the functionality to translate locally a theme

* Redirect to the selected plugin or theme, not to the main project

* Add the nonces in the URL and their checks

* Add some checks

* Download the .po and .mo files from translate.w.org if they don't exist locally

* Redirect to the locale in the plugins and themes

* Check if the file downloaded from DotOrg has fired an error

* Add the local "languages" folder inside the plugins and themes to look for .po files

* Initial import of community-translator

* Preload translations

* Make saving work

* Fix lint errors

* JS Lint fixes

* Fix eslint errors

* Update for new eslint settings

* Incorporate text domain namespacing more deeply

* Lint fixes

* Lint fix

* fix warning

* Fix wrong parameter sequence

* typo

* Fix original lookup

* Speedup initial tree walking

* Looku placeholders

* Show user translations

* Modify translation after saving

* Fix linting

* Prioritize found translations when the context is dubious

* Remove help icon for now

* Expose the text domain for translations that were not found

* Don't replace placeholders as if they were new translations

---------

Co-authored-by: Jesús Amieiro <[email protected]>

* Local REST API: Implement Saving (#1576)

* Implement a REST API for saving translations

* Remove some outdated default settings

* Don't replace placeholder translations

* Fix showing waiting user translations

* JIT add translation (#1578)

* Inline Translation: Make it work in the customizer (#1577)

* Inline Translation: Make it work in the customizer

* lint

* Prevent off-screen display of Popover

* Local: Improve multi-placeholder translation replacement (#1579)

* Improve multi-placeholder translation replacement

* Fix case where the output text was already a translation

* lint

* Initialize array

* Add renamed core projects

* Update new project paths

* Local: Unify projects generation (#1581)

* Improve multi-placeholder translation replacement

* Fix case where the output text was already a translation

* lint

* Unify project creation

* Continued unification

* Improve behavior with an empty Local GlotPress

* Fix insertion of JS placeholders

* Improve button text

* Update assets

* Fix rebase error

* Lint fixes

* Add a welcome page

* Lint fixes

* typo

* Rename WordPress project to just WordPress

* Make more strings translatable

* Allow some HTML in descriptions

* Fix lint

* Require local GlotPress to be active for inline translation

* Fix lint

* Remove actions column if there are no actions

* Replace modified strings back in again

* Fix another edge case with reinsering translations

* Fix another edge case

* Remove unused if block (#1585)

* Add a link to the frontend

* Local: Add a Contribute Back view (#1588)

* Add a Sync to w.org view

* Rename to Contribute back

* Linting

* Prototype the translation processing

* Generate PO files

* Filter the target URL

* Show English notice on Contribute back page

* typo

* Local: ask for suggested translations (#1589)

* Use ChatGPT for providing translations

* Lint

* Lint

* Allow separate user tokens and prompts

* Allow excluding certain areas

* Update prompt prefixing

* Lint

* Allow refining the prompt

* Lint

* Use ChatGPT for providing translations

* Allow refining the prompt

* Show warnings in popover

* Fix linting issues

* Remove deprecated parseJSON function

* Recompile popover

* Allow downloading the PO file to contribute back

* Add copy button

* Copy original when copy button is clicked

* Enable button submit button after copy button is clicked

* Fix typo

* Recompile popover

* Fix spacing in js lint error

* Add a translation limiter to the sync screen

* Forgotten hidden field

* Add context to PO file

* Local: Re-Sync translations from WordPress.org (#1597)

* Move local translation set creation to REST API

* Better error handling

* Fix lint

* Local: update popover and improve suggestion workflow (#1598)

* Move local translation set creation to REST API

* Better error handling

* Fix lint

* Update popover

* Improve translation suggestion UI

* Automatically activate the inline translator on the settings page

* Improve error handling

* Improve error handling

* Fix lint

* Preserve undo buffer when inserting suggestions

* Fix copy original for plurals

* Prefer active originals

* Add translatable strings to the Sync page

* Fix local PO path for plugins and themes

* Local: Show notices when the inline translation won't work (#1601)

* Local: Show notices when the inline translation won't work

* Update message

* Update text

* Inline translation settings UI (#1599)

* Show settings popout on clicking the inline translation globe icon

* Load inline translator when switch is on

* Add z-index to make pop-out show above othe elements

* Toggle popout

* Add stats to inline settings

* Make strings translatable and updates stats view

* Change popout width

* Set default value of slider to on or off depending on the value of inline translation cookie

* Remove unsued code

* Show list of translatable strings

* Add transparent background to list of translations

* Close overlay when outside the list is clicked

* Fix typo

* Hide overlay fix

* Fix lint errors

* Refactor string search

* Update style for list link

* Add live stats figures

* Refactor search function

* Remove link to GlotPress settings

* Remove unused link

* Hide settings popout when translations list overlay is shown

* Fix lint issue

* Unify CSS

---------

Co-authored-by: Alex Kirk <[email protected]>

* Add missing paths

* Local: Jump to next (#1595)

* Jump to next untranlsated string on save

* Fix lint issues

* Jump to next visible untranslated string

* Add jump to next settings

* Set default value of checkbox based on jumpToNext settings

* Local: Expose multiple matching originals (#1602)

* Discover multiple matching originals

* Fix lint

* Also use translation as search keyword

* typo

* Local: Add a Locally deploy translations button (#1603)

* Add a Locally deploy translations button

* Add missing paths

* Use WP_LANG_DIR

* Make the search terms unique

* Update minified JS

* Updates for embedding in the WordPress / GlotPress Playground

Squashed commit of the following:

commit 62a515fa5b7482bbabd19e12d213a9557f466e7f
Author: Alex Kirk <[email protected]>
Date:   Wed Apr 26 12:43:25 2023 +0200

    Disable String list by default, allow operation on MO files

commit fb4e505
Author: Alex Kirk <[email protected]>
Date:   Wed Apr 12 14:05:39 2023 +0200

    Fix notice

commit 679e3d2
Author: Alex Kirk <[email protected]>
Date:   Wed Apr 12 11:33:51 2023 +0200

    typo

commit cc7e475
Author: Alex Kirk <[email protected]>
Date:   Wed Apr 12 10:46:35 2023 +0200

    typo

commit ffd3fea
Author: Alex Kirk <[email protected]>
Date:   Wed Apr 12 10:41:13 2023 +0200

    Fixes for wasm

commit 55c1d90
Author: Alex Kirk <[email protected]>
Date:   Fri Apr 7 13:58:06 2023 +0200

    Add a Locally deploy translations button

commit f533a65
Author: Alex Kirk <[email protected]>
Date:   Fri Apr 7 13:04:15 2023 +0200

    typo

commit f2cc8fc
Author: Alex Kirk <[email protected]>
Date:   Fri Apr 7 12:59:15 2023 +0200

    Also use translation as search keyword

commit 1bd5256
Author: Alex Kirk <[email protected]>
Date:   Fri Apr 7 12:10:51 2023 +0200

    Fix lint

commit 33480d3
Author: Alex Kirk <[email protected]>
Date:   Fri Apr 7 12:02:29 2023 +0200

    Discover multiple matching originals

* Post a message when there has been a new translation submitted

* Update the inline translator

* Use a relay message for the playground

* Directly query ChatGPT via XHR

* Fix singular suggestions

* Download locale glossary

* Add original with glossary items markup to inline translation data

* Remove previously added glossary file download

* Add glossary markup to displayed original

* Import jquery-tooltip

* Add custom CSS to glossary words

* Attach tooltip to glossary words

* Style tooltip content

* Add CSS so that it doesn't get wiped out upon minification

* Update Inline Translator

* Allow external invokation of glossary import

* Avoid warnings for inexistant glossary

* Local Glossary: Fetch client-side (#1618)

* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting

* Local: Add GP_SCRIPT_DEBUG to load the unminified CSS and JS (#1614)

* Add GP_SCRIPT_DEBUG to load the unminified CSS and JS

* Update the default value for GP_SCRIPT_DEBUG to true

* Update the Grunt action to minify a JS file and add a Grunt action to copy a JS and a CSS file

* Add 3 files to the conditional loading: 2 CSS and 1 JS

* Add the browserify action to the Grunt workflow

* Add a concat action in the Grunt file to concat the CSS from inline-translation

* Watch inline translation files

* Use concat in favor of copy

* Not part of the inline translation css

* typo

* typo

* remove grunt-contrib-copy

* remove unnecessary line

* unification

* whitespace

* Update browserify destination

* Update the location to load the inline-translation JS file

* Remove the Makefile file, because all its work is now in the Grunt file

---------

Co-authored-by: Alex Kirk <[email protected]>

* Add unminified inline translation files

* Don't re-add glossary items when requerying

* Local: Copy placeholder into textarea on click (#1596)

* Copy placeholder into textarea on click

* Adapt code to work for other kinds of placeholders

* Extract placeholders and make them clickable

* Add css to placeholder links

* Fix linting errors

* Refactor code to remove duplicate insertions

* Check if placeholders have been entered

* Change background color if placeholder is missing

* Use standard color codes

* Add checkmark and strikethrough to differentiate between used and unused placeholders

* Change placeholder font color to black

* Add placeholder list beneath each textarea for plurals

* Select the  inline translation textarea

* Fix placeholders issue for plurals

* Highlight one placeholder one at a time when clicked for multiple occurrences of placeholders in the textarea

* Add margin to placeholder div

* Show list of placeholders for each plural on popover display

* Fix relaying warnings from the server-side

* Fix margin for firefox browser

* Remove unused variable

* Remove the debug dependency

* Add a space

---------

Co-authored-by: Alex Kirk <[email protected]>

* Rebuild CSS

* Load project glossary

* Show api error

* Refactor code, remove unnecessary variable

* Use JQuery's text method

* Use require_once to avoid fatal

* Allow activating GlotPress on an unsupported permalink structure since Local GlotPress will work

* Update package-lock.json

* Build the minified inline-translator files

* Update changelog

* Move the jQuery popover file to the assets directory (#1666)

* Move the jQuery popover file to the assets directory

* Ignore the new location of the jquery.webui-popover

---------

Co-authored-by: Jesús Amieiro <[email protected]>
Co-authored-by: Tosin <[email protected]>
akirk added a commit that referenced this pull request Jan 11, 2024
* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting
akirk added a commit that referenced this pull request Feb 7, 2024
* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting
akirk added a commit that referenced this pull request May 29, 2024
* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting
akirk added a commit that referenced this pull request Nov 14, 2025
* Fetch the glossary markup clientside

* Load optimization

* Avoid scrollbar appearing on window

* styling

* Use glossary when querying ChatGPT

* Linting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants