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

Seems Arabic and right-to-left text #228

Open
hoegge opened this issue Sep 30, 2021 · 8 comments
Open

Seems Arabic and right-to-left text #228

hoegge opened this issue Sep 30, 2021 · 8 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed from other folks mac-app-bundling How the Mac app bundle interacts with macOS Qt Related to Qt toolkit upstream Problem originates with or depends on something in an upstream package (like Octave itself, or Qt)

Comments

@hoegge
Copy link

hoegge commented Sep 30, 2021

Description

Downloaded app for Mac. It starts, but there is "Arabic-like" text in the Octave-GUI menu and the command terminal works RTL and entered text is shown left of the command prompt.

Environment and Diagnostics

Mac OS Catalina
US English interface

Please run system env in Octave.app, and copy & paste the output here:


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LC_ALL = (unset),
        LC_NUMERIC = "C",
        LC_TIME = "C",
        LANG = "en_DK.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
error: Invalid call to system.  Correct usage is:

 -- system ("STRING")
 -- system ("STRING", RETURN_OUTPUT)
 -- system ("STRING", RETURN_OUTPUT, TYPE)
 -- [STATUS, OUTPUT] = system (...)

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Where is octave_app_diagnostic_dump located in Octave.app - not in bin folder

Screenshot 2021-09-30 at 09 40 40
.)

@apjanke
Copy link
Contributor

apjanke commented Sep 30, 2021

Hmm. That's not great. Weird results for teh locale, but I don't see how that would directly cause this.

What's your Language & Region setup in your Mac System Preferences?

image

octave_app_diagnostic_dump is an Octave function included with Octave.app. Just run it in the Octave Command Window.

image

@hoegge
Copy link
Author

hoegge commented Oct 1, 2021

Well, Arabic WAS installed but not default (had to test RLT text at some point):
image
So seems like Octave takes tha last languate - or some of it.
Dump output


Creating diagnostic dump. Please be patient...
tar: Failed to set default locale
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LC_ALL = (unset),
        LC_NUMERIC = "C",
        LC_TIME = "C",
        LANG = "en_DK.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
warning: LFLAGS is deprecated and will be removed in a future version of Octa
ve, use LDFLAGS instead
Dump complete. Output file is: octave_app_diagnostic_dump.txt

octave_app_diagnostic_dump.txt

After removing superflous languages:
image
the problem is gone in Octave. So Octave does apparently not select the primary but the last or the first alfabetically listed (Arabic) language.
And now the menus also look right:
image

But that means it does not take the last Language (Danish) or the first by alphabetic order either (Danisk).

Don't know. But immediate problem solved, but other might run in to same issue.

Thanks

@apjanke
Copy link
Contributor

apjanke commented Oct 1, 2021

Ah, yeah: this is some weirdness related to the fact that macOS's locale & language definitions are defined in the Mac layer above the Unix layer, and they get mapped to Unix lcales but the mapping isn't perfect, and I'm not sure which layer Octave and Qt use for language/locale discovery.

I think this is a problem in upstream Octave, not something specific to the Octave.app packaging. I'll try reporting this upstream over the weekend and see what they have to say. You could also report it yourself, on their Savannah bug tracker: https://savannah.gnu.org/bugs/?group=octave

Leaving this open for now.

@mmuetzel
Copy link

Octave uses Qt functions to query the systems locale (QLocale::system()).
That is passed to QTranslator::load to load the translation file for its GUI.

ISTR that I read somewhere that the very first menu cannot be touched by Qt on macOS. That is created and translated by the OS automagically. (I can't see that menu in Octave on Windows. The first menu is the "File" menu.)
Is it possible that Apple localized that menu for Arabic, but they didn't for Danish?
Are the other menus and the remainder of the GUI also appearing in Arabic? Or is it just the first one?

Is there some API on macOS that an application can use to signal which language it would like to use for that menu?

IIUC, an application should bundle a "localized resource folder":
https://doc.qt.io/qt-5/macos-issues.html#translating-the-application-menu-and-native-dialogs

Does octave-app do that?

@apjanke
Copy link
Contributor

apjanke commented Oct 19, 2021

Does octave-app do that?

Nope: Octave.app does almost nothing besides package up a dedicated Homebrew-prefix environment that includes Octave and all its dependencies plus a little launcher script and a couple trivial diagnostic scripts into a macOS app bundle, and stick that in a DMG installer. All the Mac-specific Qt stuff in Octave.app is provided by upstream Octave. Octave.app is basically a packaging and deployment layer on top of Octave; it doesn't change any behavior aside from some basic $PATH stuff to make it work right when launched by double-clicking the app bundle instead of launching it from a shell command line which has its $PATH set up by the user's shell login scripts.

I could see adding some additional stuff like this to Octave.app to make it behave nicer as a Mac app, but I definitely do not have the resources to do any translation or localization. And it seems like this would fit better in core Octave, since it does other stuff to make octave --gui run nice as a native macOS application; it just doesn't roll it up into an app bundle or provide a drag-and-drop installer.

Is there some API on macOS that an application can use to signal which language it would like to use for that menu?

I think this might be the macOS-specific API for detecting locale stuff (as opposed to the vanilla Unix one). I wouldn't know how to use it to solve this issue, though. Especially the part about right-to-left text in the command window.

@apjanke apjanke self-assigned this Oct 19, 2021
@apjanke apjanke added bug Something isn't working help wanted Extra attention is needed from other folks Qt Related to Qt toolkit upstream Problem originates with or depends on something in an upstream package (like Octave itself, or Qt) labels Oct 19, 2021
@mmuetzel
Copy link

I could see adding some additional stuff like this to Octave.app to make it behave nicer as a Mac app, but I definitely do not have the resources to do any translation or localization.

I'm not a Qt nor macOS expert (not at all). And the Qt documentation doesn't go into much detail. Some of the few sentences on that topic seem to be cut off.
But from what I think I could gather, it looks like these localized strings come from the OS (not from upstream Octave).
IIUC, a packager wouldn't need to do that localization. All that seems to be necessary is adding a locversion.plist file for each locale the app supports.
We could maybe add these files to upstream Octave. But this seems to be very platform-specific.

On the other hand, the Qt documentation says:

The items in the Application Menu will be merged correctly for localized applications, but they will not show up translated until the application bundle contains a localized resource folder.

However, the application menu does seem to get localized as reported in the OR.

Do I misunderstand the way packaging is supposed to work on macOS?

Does localization for the rest of the GUI (i.e. everything apart from the application menu added by the OS) work in Octave on macOS?

@apjanke
Copy link
Contributor

apjanke commented Oct 19, 2021

Hmmm. I don't know the answer to either of those questions. I'm going to have to do a little reading and experimenting here.

@mmuetzel
Copy link

In case, I wasn't clear before wrt the second question: Does the interface language change if you select a different language in Octave's preferences dialog and restart Octave?
image

@apjanke apjanke added the mac-app-bundling How the Mac app bundle interacts with macOS label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed from other folks mac-app-bundling How the Mac app bundle interacts with macOS Qt Related to Qt toolkit upstream Problem originates with or depends on something in an upstream package (like Octave itself, or Qt)
Projects
None yet
Development

No branches or pull requests

3 participants