rocklobster-in / bogo Goto Github PK
View Code? Open in Web Editor NEWThis is the development repository for Bogo, a straight-forward multilingual plugin for WordPress.
Home Page: https://wordpress.org/plugins/bogo/
License: Other
This is the development repository for Bogo, a straight-forward multilingual plugin for WordPress.
Home Page: https://wordpress.org/plugins/bogo/
License: Other
When the user locale is en_US
and in the Posts screen (Posts > All Posts) you select Japanese from the "Show all locales" filter, the whole UI should keep English, but it actually shows Japanese.
For example Contact Form 7 has the Privacy Notices section in its plugin page (readme.txt):
Privacy Notices
With the default configuration, this plugin, in itself, does not:
- track users by stealth;
- write any user personal data to the database;
- send any data to external servers;
- use cookies.
If you activate certain features in this plugin, the contact form submitter’s personal data, including their IP address, may be sent to the service provider. Thus, confirming the provider’s privacy policy is recommended. These features include:
- reCAPTCHA (Google)
- Akismet (Automattic)
- Constant Contact (Endurance International Group)
Let's add an appropriate privacy notices to Bogo's page as well.
Related forum topic: Category base and Category archive
When you set the Category base option, localized permalinks are not created for category. The same problem is seen with post tags.
While you'll find a post-ID-like integer in the _original_post
post-meta value, it is actually not used as a reference to any post. It just indicates that "If there is another post with the same _original_post
, it is a translation copy with the same origin." So, it can be any value, as long as it is unique.
To clarify this rule and ensure it works correctly even when you export posts to another site, let's use the GUID for the default value of _original_post
. You can use get_the_guid()
to get the GUID of a post.
It seems that there are some compatibility issues between the current version of Bogo and the Block Editor (Gutenberg).
You can make function calls efficient by using static variables appropriately.
They are already used in some functions of Bogo.
These functions should use static variables but are not using them now:
bogo_get_post_translations()
in includes/post.phpRelated forum topic: Bogo & Sitemap
About XML Sitemaps: New XML Sitemaps Functionality in WordPress 5.5
I could confirm that localized posts are not included now.
In bogo_duplicate_post()
, a new translation post inherits the original post's post-metas excluding non-inheritable post-metas. Non-inheritable post-metas are _locale
and _original_post
now, and they are not customizable. In some cases you'll need to add some post-metas to this list. For such cases let's add a filter hook that allows to do so.
If you have post-metas that you think should be in the non-inheritable list, take this opportunity to add them to the default list.
**
to wrap a menu item (Languages > Installed Languages)BOGO_VERSION
constant to 3.3 in bogo.phpSee https://make.wordpress.org/polyglots/2020/03/26/the-language-name-in-english/
In includes/functions.php we have "Punjabi" now. If the name is changed in https://translate.wordpress.org/ then we will change it as well.
Major part of the current rewrite rules generating process (includes/rewrite.php) was implemented almost 10 years ago. We should be able to do a lot of things to improve it with the current rewrite API of WordPress.
Update the package.json file following webpack documentation.
Rewrite admin/includes/js/admin.js without using jQuery.
BOGO_VERSION
constant in bogo.php to 3.5When opening Languages > Terms Translation you see two PHP notices because there are unidentified index used.
https://core.trac.wordpress.org/changeset/45926
Following this WP core change, let's check translator comments used in our code and improve them if necessary.
In determine_locale()
, get_user_locale()
takes priority over get_locale()
when is_admin()
returns true. This makes the lang
variable unintentionally ignored in the admin screen.
https://github.com/takayukister/flamingo/wiki/Coding-Standards
Some parts of Bogo code are old so you may find code that is not following the coding standards. Let's check whole coding and refactor based on the standard on this occasion.
Sometimes the process takes a bit long time than that expected and makes users feel lost.
See https://developer.wordpress.org/block-editor/components/spinner/ for the Spinner component.
Use short names of languages.
Hi, I have built a custom rewrite rule that includes also the locale.
Since the update to 3.5 it is not working anymore.
This is my custom rewrite rule:
// Photogallery filter pictures by event
add_rewrite_rule( '^([^/]*)?/?gallery/([^/]*)/([^/]*)/event/([0-9]+)/?$', 'index.php?competition=$matches[3]&external_id=$matches[2]&event=$matches[4]&lang=$matches[1]','top' );
The first capturing group is the locale. If I use the query string url is not working anymore.
Any quick clue? I will investigate more in the next hours, at the moment I hotfixed reverting the 3.4 back
The bogo_access_locale
capability determines if the user is permitted to access resources in the specific locale. The check of this capability should be done inside another meta capability check (such as edit_post
or delete_post
).
BOGO_VERSION
constant to 3.3.2 in bogo.phpBOGO_VERSION
constant in bogo.php to 3.3.4Register post metadata (we are using _locale
and _original_post
now) using register_post_meta()
.
See includes/language-switcher.php
<span class="language-name"></span>
current
class to the current <li>
and <a>
aria-current="page"
to the current <a>
In post translation meta widgets the en_US
translation appears even when en_US
is deactivated in the Language Packs page.
https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/
Date/Time component has been improved in WordPress 5.3. A lot of date/time related functions are now obsolete, and sophisticated alternatives are available.
Let's refactor our code using new recommended date/time functions.
No auth_callback
arg is set in the register_post_meta()
calls. The auth_callback
arg is optional, but __return_false()
is assigned if omitted.
Related forum topic: Gutenberg: Updating failed with custom post meta
In bogo/includes/post.php we use the wp_unique_post_slug
filter hook to generate a post slug unique within the same locale. We can change the hook to pre_wp_unique_post_slug
(introduced in WP 5.1.0), and this change should make the process much more efficient.
BOGO_VERSION
constant to 3.3.3 in bogo.phpSometimes the display name of a language gets unnecessarily long. For example, you don't need to display the full name of "English (United States)" when you don't have other English languages like "English (UK)", you'll think just "English" is OK.
My suggestion is to add a "short name" option to bogo_available_languages()
. The option should have a boolean value, and when the value is true, the output of the function will be shortened, as long as it's appropriate, by removing tails in parentheses.
BOGO_VERSION
constant in bogo.php to 3.4Bogo sets its lang
cookie in bogo_init()
(bogo.php), but this cookie has actually been unused for a long time. We have to decide to drop this setcookie()
, or make its use restricted with new cookie settings.
Related issue: #11
These locale codes on the Languages > Language Packs menu page don't have their language names yet. Update bogo_languages()
in includes/functions.php to add their locale code and language names (in English). Correct language names should be retrieved from https://translate.wordpress.org/
Since WordPress 4.7 introduced the concept of user locale, its API has been improved a lot, and we can utilize it to improve Bogo's code around user locale management.
The current Bogo's coding is mainly based on very old versions of WordPress (5+ years old), and there is much space where we can make it much more efficient using APIs the current WordPress provides.
The project aims to raise the minimum supported WordPress version to 5.3 in the next release (Bogo 3.3). This also means we can use new PHP features available in PHP 5.6.20+ in plugin development.
We plan to do coding modernization in the following areas:
If there is a possibility to be used in admin screens.
Related: #77
Always refer to bogo_available_languages()
output for language names.
If you switch locale too early, lang tags in header (such as <html lang="en-US">
) may be unintentionally affected by the user locale.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.