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

Closes #147: provide reason why string templates shouldn’t be used #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aral
Copy link
Contributor

@aral aral commented Nov 5, 2021

Specifically, because they cannot be localised.

…be used

Specifically, because they cannot be localised.
@danirabbit
Copy link
Member

Is there a more specific subsection that could be linked to here? It's not immediately obvious that this page contains information to back this up

@aral
Copy link
Contributor Author

aral commented Nov 9, 2021

@danrabbit Shall I remove the link? I’ve first-hand confirmed that template strings are not localisable (unless there is some configuration setting that’s not included in the developer guide for making them so) so the link is not necessary (I thought it would provide some interesting/related background).

For non-localised strings, I don’t know of any reason why template strings should not be used. Perhaps we should mention that also.

@danirabbit
Copy link
Member

I'm not doubting you, I'm just wondering if there's a more specific section of this guide that mentions this. Otherwise yeah, it might not be worth linking here. It might be worth opening another branch with a little hint pullout in the localization section for this guide though

I don't think we really necessarily need a reason other than this is the code style we use. A lot of things here—like cuddled else—are just convention

@aral
Copy link
Contributor Author

aral commented Nov 10, 2021

Haha, didn’t think you were doubting me :) (Although, please do, I’m very new to these platforms.)

Regarding stating the reason: I feel it’s important as you don’t want these things to become religious in nature (ditto for design decisions). Some conventions, of course, are just that. But, in this case, template strings provide a major usability advantage to format strings in that you don’t have to remember a bunch of type placeholders and there is a compelling reason why they can’t be used so I feel it would be useful.

I’m happy if we do so without the link if you feel the link would add more confusion than clarity :)

@danirabbit
Copy link
Member

@aral yeah if you don't have a more specific link handy, I would just omit the link

@@ -310,7 +310,7 @@ print ("Hello World");

## String Formatting

Avoid using literals when formatting strings:
Avoid using literals when formatting strings, as they cannot be [localized](https://wiki.gnome.org/TranslationProject/DevGuidelines):
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about using "translated" instead of "localised"? That would not need any link.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey there, feels like localized is more precise. The strings can be translated (if someone translates them) but they cannot be localized (ie., those translations cannot be used within the app).

Perhaps: “…as they will not appear in the list of translatable strings for localization.”

Copy link
Collaborator

@jeremypw jeremypw Dec 11, 2021

Choose a reason for hiding this comment

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

Hmm, not sure. I am trying to find a non-technical wording so that no explanatory link is necessary. How about something like "... as any translation of them will not appear in the app"

@jeremypw
Copy link
Collaborator

@aral Are you in a position to progress this?

@aral
Copy link
Contributor Author

aral commented Dec 11, 2021

@aral Are you in a position to progress this?

Will do.

@jeremypw
Copy link
Collaborator

Thanks - don't forget to resolve the conflicts with master.

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

Successfully merging this pull request may close these issues.

3 participants