Skip to content
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

Bee and translations #405

Closed
yorkshire-pudding opened this issue Jul 22, 2024 · 9 comments
Closed

Bee and translations #405

yorkshire-pudding opened this issue Jul 22, 2024 · 9 comments

Comments

@yorkshire-pudding
Copy link
Collaborator

Bee has a function bt() that calls the Backdrop function t() if it exists. Most places in the code use this to define the text displayed, but is there any point in this?

Does the existence and calling of this command cause phrases to appear for translation in the list of phrases for translation (i.e. admin/config/regional/translate/translate)?

Does the fact that Bee can work across multiple sites but translations are for each site mean this functionality is not useful?

Has anyone who natively speaks another language translated any phrases for bee?

I note drush does the same, so has anyone translated phrases for drush?

@indigoxela
Copy link
Member

Short answer: never used that.

I already asked myself, if anyone would ever make use of this bt(), anyway. Personally, I wasn't even aware that drush shipped with that, too. It seems odd to me, that a command line tool ships with such translations.
I also find it odd, that the actual translations get stored in Backdrop CMS instance databases. Which means, they may even be different, depending on the instance in context...

@avpaderno
Copy link
Member

On Drupal, I changed the code for a Drush hook to use dt(). Then I thought that, before Drush bootstraps Drupal, the messages would be in English; after Drupal is bootstrapped at a level sufficient to access the database and have translation available, the messages would change to a different language.
Seeing messages first in English and then in a different language seems a bit confusing. For a multi-site installation where each site is set with a different language, that could be more confusing.

I guess that would happens with Bee too.
I would not say it is not useful. I would say that somebody who uses low-level tools like Drush or Bee should be used to English messages to understand them.

@yorkshire-pudding
Copy link
Collaborator Author

Has anyone seen any phrases from bee in the list of translations? I've tried by:-

  1. creating a dummy second language
  2. switching to the dummy language
  3. invoking some bee commands that use full bootstrap
  4. searching for messages in those commands within the list of phrases, but not succeeded in finding any Bee phrases.

@indigoxela
Copy link
Member

indigoxela commented Jul 25, 2024

@yorkshire-pudding I never tried it so far... But can't trigger it on my sites, either. I wouldn't know how to. The locale of the commandline on my dev box is en_US.UTF-8. 🤷 (Not sure if the locale even matters.)

@avpaderno
Copy link
Member

avpaderno commented Jul 25, 2024

For what I recall, localize.backdropcms.org just have translations for Backdrop core. The only way to see translations for Bee would be to set the translations in the locale_custom_strings_$langcode setting. If the global $language is set, the translation would be picked up.

@indigoxela
Copy link
Member

@avpaderno unless I completely misunderstood things here, this isn't about localize.backdropcms.org, but rather about local translation strings on admin/config/regional/translate/translate of the current instance.
That's where t() usually puts translatable strings if triggered - which I'm not able to.

@avpaderno
Copy link
Member

avpaderno commented Jul 25, 2024

Oh, the translation source strings are in the locales_source database table.
If locale() is available, any string passed to t() will end up in that table, whose content is then shown in admin/config/regional/translate/translate.

I apologize: My previous comment was about the translation target strings.

@yorkshire-pudding
Copy link
Collaborator Author

OK. I think I figured it out by looking at t(). The default language in Backdrop has to be set to a language other than English and then items from Bee start showing up in admin/config/regional/translate/translate.

And it works

user@machine:~/projects/bee/backdrop$ lando bee cron -d
 ℹ  Eh up lad! watch out for 'em bugs

 ✔  Cron ran successfully.

user@machine:~/projects/bee/backdrop$

So probably useful to keep doing it, but it might be more useful to add context so it is clearly from Bee.

@yorkshire-pudding
Copy link
Collaborator Author

I've created a ticket for an enhancement (#410 ) to add context to Bee's translatable strings. Feedback appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants