-
Notifications
You must be signed in to change notification settings - Fork 141
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
Feature request: gender and plural in the autofill #920
Comments
In the original post, @tw2113 answered the following: Definitely willing to help wherever we can. For the plural and singular, I believe we’re doing that directly on the fields in CPTUI via data attributes, for example: https://github.com/WebDevStudios/custom-post-type-ui/blob/master/inc/post-types.php#L417-L431 And then we’re doing the actual filling via https://github.com/WebDevStudios/custom-post-type-ui/blob/master/src/js/cptui-scripts.js#L241-L274 where we grab the attributes and fill in with JS and some quick string manipulation. So I believe we’d need to touch up those fields that have the %s placeholder already to be a bit more robust. Not sure if https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals would be a good fit for this place, since that may be more for variable numbers and countable variations, as opposed to just singular/plural for movie vs filme and movies vs filmes. The gender topic presents a more difficult, though I have to believe still accomplish-able process. All said, would you be willing to movie this over to https://github.com/WebDevStudios/custom-post-type-ui/issues so that we can keep it more visibly tracked instead of just on the forum here? |
I agree that not, after all, we would have to translate everything into two versions even though they are not totally correct. I am not a developer, so I don't know if I can help in terms of technical solutions. But I know the features of the plugin well as well as the internationalization process (from English to Brazilian Portuguese at least), so if you can help with something, let me know! |
Thinking about this in parts, to not overly confuse myself. So I'm focused on the singular/plural aspect of things at the moment. Since we have at least standard The actual issue is on the javascript side where we are looking at a second data-attribute for which version we think should get used, "singular" or "plural". The question then turns to how do we offer any sort of ability to change that data attribute. Even with the ability to detect current languages, we'd still need to 1) Add filters to each plurality setting, 2) Offer a way to conditionally set for each label in a smart way so that only ones that need changed, are. I am also pretty certain that https://developer.wordpress.org/reference/functions/_x/ would not be worthwhile solution because that still is run BEFORE the actual switching occurs. |
@wiliamjk is there a for-sure set list of labels that would work better with plural instead of the singular that they're receiving now? A potential solution that I'm envisioning is some sort of filter that could be added to the To make that work though, I'd need a definitive list of which labels would work better that way. |
Gimme some time to ponder over that one, that I do know that by default we are switching out the word |
Understood if you don't fully understand the javascript portion of this, but the way I'm seeing potential for the singular/plural portion of this, is that when translating these specific autopopulate values, it'd be a case of returning either So in our javascript, we'd need to amend this section linked below, to first check for https://github.com/WebDevStudios/custom-post-type-ui/blob/master/src/js/cptui-scripts.js#L259-L273 Is that making sense here? If yes, I'll branch out into a new issue dedicated for just that process, and then resume mulling over the gender aspect. |
I think that's it! You can do it. I think it's important not to forget to add descriptions in the related strings so that translators from other regions can adapt the translations: https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#descriptions |
Absolutely on the descriptions and helper text. We would need to update appropriately for the comments like these: |
Branched off a new issue for the plurality over at #921 |
On the topic of the gender aspect, I'm having a much bigger problem trying to think of a way to resolve this since it's coming down to a lot more variables in play. Yeah we could provide a dropdown that allows for specifying the gender, but then we have to also add in and provide strings ourselves for both variations, at minimum for as many languages as we can manage and detect which are used. On the flipside, I would point out that the autofill functionality is definitely a nice touch, but also not a required step to use or set up. So I'm wondering if it'd maybe be a bit more advantageous to show some quick messaging, for languages that do have the different gender possibilities, about doing a quick spotcheck review of the genders and touchup as needed. Yes we'd still be requiring that review, but it'd be proactive in reminding the potential site owner to do so. |
@wiliamjk Greek does that. (Probably others too, no doubt, but that's the one that immediately comes to mind for me). |
Originally published here: https://wordpress.org/support/topic/feature-request-gender-and-plural-in-the-autofill/
I am a project editor responsible for translating your plugin into Brazilian Portuguese. As I use your plugin on almost every website I manage, this is very helpful.
However, the standard CPT label autofill feature has some limitations related to internationalization. That’s why I’m creating this topic so that we can discuss the possibility of making your plugin even more useful for foreign users.
Plural and singular
The first observation concerns plural and singular in some autocomplete strings.
I’ll give you an example from Portuguese:
In English, the phrase “Movie archives” uses the word “movie” in the singular. But in Portuguese, the most appropriate translation is in the plural. I will show step by step:
Movie -> Filme
Movies -> Filmes
archives -> arquivo (in Portuguese and with this meaning, this word is always translated in the singular)
Movie archive -> Arquivo de filmes (the noun is at the beginning with its attributes at the end. The word “de” indicates that the movie belongs to the archive)
But if I use the autofill it will generate this wrong sounding label: Arquivos de filme
This happens with several other sentences like “no movie found in trash”, for example. Also, I suspect other languages may have similar issues.
One suggestion that I don’t know if it’s possible to implement, but that would solve this problem, would be to use WordPress Translate’s placeholder feature:
Note that, in the translation, I need to insert the %s placeholder to define where the plugin will autofill.
We could define a placeholder for the label in the singular (%1$s) and another for the plural (%2$s) and we choose the most suitable one in the plugin’s translation. That way, regular users don’t even notice (it will just work) and people who know the language well can adapt it in the internationalization process. It would be possible?
Gender
The languages originating from Latin (and others as well) have a characteristic that is the gender of nouns.
For example, the word “Filme” (movie) is a masculine word, whereas the word “Página” (page) is a feminine word.
So “all movies” and “all pages” work fine in English just replicating “all _“. But, in Portuguese, the expression “all” must agree with the gender:
All Movies -> Todos os filmes
All Pages -> Todas as páginas
I’m not sure how it works in other languages, but I believe some even accept a neutral third gender.
This is a problem for your plugin’s internationalization because it will always autofill with the same gender, regardless of the gender of the selected word. This involves a mandatory manual review.
To resolve this, I thought it would work like this:
You can add languages little by little, checking if the functionality is suitable for the community.
—
I thought it might be a good idea to document this suggestion here for you to consider. As I mentioned, I use your plugin to create dozens of CPTs on different sites and something like this would save a lot of time manually reviewing the labels.
Anyway, thanks a lot for the excellent plugin!
The text was updated successfully, but these errors were encountered: