Thanks for the "Start Dictation" Menu

Dear Xojo,

Thanks for the automatically adding Edit->Start Dictation menu to my Cocoa apps. It saved me a bunch of time not having to enable this for every text area, etc. :slight_smile:

You might want to document this.

That may be a Cocoa feature from Apple…

PS: We also have StartDictationMBS (Carbon) and NSApplicationMBS.startDictation (Cocoa) in the plugin to start it anytime.

Apple requires apps have their menus set up in a particular way to get certain things “for free”.
This is one of those spots we had to do some work to to make it happen.

Now Xojo apps just have it - no work required.

there is a problem with other than english or uk builds: the “start dictation” edit menu is missing.
<https://xojo.com/issue/48657>

still not working as of today Xojo 2018r2
how can I have a start dictation item working in my apps ?

Did you provide a localization for the Edit menu name? If you do then the dictation item shows up for me. Here are the steps I did:

I added a public constant to App:

Then used it in the menu:

And when I run I see “Dmarrer Dicte” in the dition menu:

@Paul Lefebvre : many thanks ! was searching for that for years …
may be you could add some help in the documentation about this because it’s really not obvious.
I named my edit menu as “Edition” and it needed exactly the same as the system so “Édition” !!!

you could also close the <https://xojo.com/issue/48657> and <https://xojo.com/issue/25050> ?

So… Paul… how is it that it always shown up in my menus? And I have no localizations of any kind set, and never have… just curious :slight_smile:

@Dave S : the system always adds a start dictation menu item
may be if you change the menu name “Edit” to "Edit " (with a trailing space) it will disapear ?

[quote=405913:@Jean-Yves Pochez] the system always adds a start dictation menu item
may be if you change the menu name “Edit” to "Edit " (with a trailing space) it will disapear ?[/quote]
I thought Dave was the one who figured out that workaround in the first place lol

Because you are working in an english speaking envorinment and this only affects non english environments? :wink:

As others said, if the Edit menu is called “Edit” on English systems then those special menus are added automatically. On non-English systems you need to have a dynamic constant to change “Edit” to the corresponding word for the system language.

failed to see that (and actually still fail to see where that was stated)… but ok

If you are working on one language you don’t need to localize the English version. Maybe that’s not the correct way to do it, but you can. You only need to have the correct menu name in the language you are working on.

In Spanish I normally use Editar for Edit, but that’s not what the macOS is looking for to add the “Start dictation” and “Emoji” submenus. macOS is looking for “Edicin”.

Also macOS adds a search submenu in Help (Ayuda in Spanish). As mentioned above, you just need to slightly change the menu name if you don’t want those submenus to show.

One strange thing: if your Edit menu is empty, it will still show the Emoji option (the same as the Help menu will show the Search option). If you add something to Edit, even an empty item, then you will get the “Start dictation” too.

Of course, the macOS needs to run the same language as primary to add those options to the menu. I can have my app with Spanish only menu and when I run it with English as Primary on Language & Region, then I don’t get the special menu items.

It is stated in the User Guide which I’ve updated to call it out more and include links to the Localization section.