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

Show sizes less than 1GB in more detail #737

Open
wants to merge 1 commit into
base: qml
Choose a base branch
from

Conversation

AaronDewes
Copy link
Contributor

PR is quite large due to the autogenerated .ts updates, the actual change is in main.qml.

grafik
grafik

<location filename="../main.qml" line="891"/>
<location filename="../main.qml" line="899"/>
<source>Online - %1 MB download</source>
<translation type="unfinished"></translation>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this could copy-paste from the message above, substituting GB for MB?

<message>
<location filename="../imagewriter.cpp" line="604"/>
<source>Format card as FAT32</source>
<translation type="unfinished">将SD卡格式化为FAT32格式</translation>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right - it's marked as "Unfinished", but definitely has a translation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was like that previously. Probably the translator forgot to check the "finished" checkbox in Qt Linguist.

<location filename="../main.qml" line="891"/>
<location filename="../main.qml" line="899"/>
<source>Online - %1 MB download</source>
<translation type="unfinished"></translation>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in zh-TW, maybe adapt the message above?

@@ -894,7 +894,9 @@ ApplicationWindow {
? qsTr("Cached on your computer")
: url.startsWith("file://")
? qsTr("Local file")
: qsTr("Online - %1 GB download").arg((image_download_size/1073741824).toFixed(1))
: image_download_size >= 1073741824
? qsTr("Online - %1 GB download").arg((image_download_size/1073741824).toFixed(1))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking on this further - given we're reusing GB/MB across languages, perhaps we could make GB/MB and untranslated parameter to this string, and just prune it from the translations?

@tdewey-rpi
Copy link
Collaborator

Conceptually, approved.

Implementation-wise, however, I think it'd be simpler to just extract the GB/MB specifier and make that an untranslated argument

@AaronDewes
Copy link
Contributor Author

Conceptually, approved.

Implementation-wise, however, I think it'd be simpler to just extract the GB/MB specifier and make that an untranslated argument

Yeah, that sounds better 👍

@lurch
Copy link
Contributor

lurch commented Nov 21, 2023

Is it safe to assume that "GB" and "MB" are valid abbreviations for "GigaByte" and "MegaByte" in all foreign languages? E.g. IIRC French uses "MO" instead of "MB"? https://forums.commentcamarche.net/forum/affich-1921093-mb-en-mo-conversion-et-difference

EDIT: See e.g. https://github.com/raspberrypi/rpi-imager/blob/qml/src/i18n/rpi-imager_fr.ts#L81-L82

@tdewey-rpi
Copy link
Collaborator

Is it safe to assume that "GB" and "MB" are valid abbreviations for "GigaByte" and "MegaByte" in all foreign languages? E.g. IIRC French uses "MO" instead of "MB"? https://forums.commentcamarche.net/forum/affich-1921093-mb-en-mo-conversion-et-difference

EDIT: See e.g. https://github.com/raspberrypi/rpi-imager/blob/qml/src/i18n/rpi-imager_fr.ts#L81-L82

Every day is a learning day!

I had assumed that since 'byte' is a technical term, it would be conserved across languages. Clearly, that was an incorrect assumption, and I would hate to impose an Anglosphere choice on the French-speaking world.

You've freedom of implementation, @AaronDewes, but I would strongly prefer that we copied over the skeleton of the GB text translations where possible - translations are offered on a best-effort basis, and I'm confident the translation suppliers would welcome you adapting their translation to cover this subtly different presentation case.

@lurch
Copy link
Contributor

lurch commented Nov 21, 2023

Going out on a bit of a limb - and at the risk of overcomplicating things - perhaps it's worth having a set of "formatted_size" translatable strings which could then get used by translations?

e.g.
english_size_mb: "%1 MB"
english_size_gb: "%1 GB"
english_image_size_label: "Disk image %1 is %2"
french_size_mb: "%1 Mo"
french_size_gb: "%1 Go"
french_image_size_label: "L’image disque de %1 fait %2"

So it might display "Disk image Raspberry Pi OS (64-bit) is 1.1 GB" in English, or "L’image disque de USB Boot fait 0,8 Mo" in French? But I've no idea how or even if that would work with the QT localisation stuff.

Note that I included both the number and the "MB/GB" in the same translatable string (rather than having "Disk image %1 is %2 %3"), because some languages might need to place the "MB/GB" part before the number part?
Doing localisation properly is tricky... 😉

EDIT: Oh, and of course some languages use the comma-character as the decimal-separator too 😀 (I've edited the examples above)

@tdewey-rpi
Copy link
Collaborator

I defer to @AaronDewes, but also suggest that could be a follow-up PR at a later date.

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

Successfully merging this pull request may close these issues.

3 participants