-
Notifications
You must be signed in to change notification settings - Fork 114
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
human readable and random ids for messages by default #1892
Comments
@inlang/editor @inlang/ide-extension @inlang/paraglide-js @martin-lysk good idea? The implementation cost is relatively simple |
The idea is inspired by what3words.com. @felixhaeberle in the ide extension you can auto fill the generated message id. i expect most devs will just hit enter |
Lovely, a lib exists for this https://www.npmjs.com/package/human-id. three words have 15 million possibilities. 15 million possibilities should be enough for even the largest enterprise use cases. adding a forth word increases the possibilities manifold further |
It depends on the developer's workflow and whether they like it. I only mention this because these could be possible thoughts:
An alias/comment/description/context field may be necessary. Again, it is something to fill in and find names. |
This is exactly the problem. Every large enterprise project states: Do not link message ids/keys to content. It breaks everywhere. Hence, my proposal to choose a default for inlang users that is human readable but has no meaning. |
We could start with this approach as the message name and let people change it if we don't want the user to stuck in the "hmmm what would be a good name for that thing" loop - as an Id i am not convinced since it lacks some properties but i need to think on this a bit more |
What properties are missing?
|
I like the idea very much! As a dev, I sometimes recall the id to reference messages I repeatedly use. This would become harder if the ids don't reflect the message. If the IDE helps me to select a messages id (maybe with fuzzy finding), even better, than trying to recall ids and coming up with some structure for the id names. |
I have to say I was initially very sceptical of using random IDs, however, the more I think about it the more I come around to it. Many developers will likely have the same experience. I do have one concern. (Perhaps the IDE extension could kick in after someone types Prefilling message-id fields with randomly generated ids would nudge developers towards the optimal workflow, but without forcing them. They can still use meaningful ids if they want. If we provide the appropriate IDE tooling, devs will come around to it. That's the Tailwind effect. |
The concern I have here: One should not reuse messages in different contexts. Now the next feature is developed: a screen with an information about a new Feature - again the initial iteration just contains "Ok" as a dismiss button. Fuzzy search will bring up the "blue_dot_map" button if we choose it - two buttons in complete different context reference the same Ok message. This is more likely to happen with this Approach since developer we loose the information about where the message should be used, also such a case would be hard to check in a code review.
vs.
I see the point that developer should not struggle with giving missing messages a meaningfull name so. https://lokalise.com/blog/translation-keys-naming-and-organizing/ I think messages should have an id (immutable / unique) and a name maybe even aliases |
Yes. This is the way to go. Treat the "name" as any other (meta) information according to a message, like a category (modal) or department (marketing). What's really important for the dev is the ID, and we should simply design a great UX in the IDE extension to search by any of the meta information or unique id & provide great auto-filling / discovering. Additionally: Very high incentive to then install the IDE extension because without, you are stuck with id gibberish.
But this doesn't has to be the case ultimately, because paraglide could also offer resolving from key OR from id. Duplications in key names could be found by a lint rule. Tree-shaking could also be preserved.
Both can be solved through either resolve from key or from id, or with a great UX in conjunction with the IDE extension. Let's face it – the problem is complex & we need tooling to make it better. In the end, looking at big enterprises, no other implementation besides the unique id will scale. |
Let's conclude the discussion 📺 watch the LOOMProposalIntroduce random, human-readable IDs by default.
Why
Additional notes
|
will be part of #1844 |
A somewhat devil's-advocate reaction follows. (IOW, I'm not trying to dispute this proposal or argue against it. Consider this as coming from a place of neutrality -- neither for nor against the idea.)
[citation needed]? @martin-lysk shared the "overwhelming article" (...? it's a 5-minute, large-font read), which contains arguments/advice in direct opposition to what's proposed here. So it feels like there should at least be some sort of supporting evidence on the pro side, as well.
That's fair, and a good argument for at least some sort of automatically-generated ID scheme.
Surely a sufficiently good IDE can prevent that even when IDs are user-chosen, though? Sort of conflating unrelated things, here -- again, devil's advocate. "Ensure users cannot choose invalid IDs" is solvable in more ways than "choose IDs for the user", isn't it? Even if the latter does technically avoid the former problem, in a swatting-a-fly-with-a-sledgehammer sort of way.
They can, but is there any empirical data indicating that they will? Or is that merely a hypothetical scenario? If a piece of code has a message ID Are they more likely to say:
or will they ignore randomly-chosen IDs and resort to contextual descriptions, like:
|
Hey @ferdnyc, I am replying to address your concern, but please do not reply. This discussion is closed. We formed a decision. Re-opening this discussion would take resources from other tasks. Before I start, It is crucial to understand that anything we implement at inlang needs to work across an organization and, therefore, across different teams with different needs. I assume that you are coming from a dev (only) perspective, which fails inlang's mission to make globalization of software simple(r).
The article is overwhelming because this 5-minute read is part of hundreds if not thousands, of hours that larger teams will discuss naming conventions. Wasted hours because a consensus will not emerge. Rules like "describe in the ID where messages are used" will be ignored, will differ between teams, and sometimes can't even be established. For example, we know that users want to create messages via Fink. They have no context to create a message according to a "provide context rule". And neither might a system that automatically creates messages (think of automatic extraction).
Every app in the ecosystem (designers, translators, marketing, ...) would need this validation. Yes, we could add a mechanism to the linting system, but why lint something that we can (likely) avoid altogether by using human readable IDs instead of random hashes?
You came to the button of the proposal here. This discussion is not about preventing you from aliasing messages, merely that our ID system is human readable instead of random hashes. We believe human-readable ids will eliminate the need for naming discussions.
Experience we have in i18n software. Naming conventions are rotten because they don't work for i18n, where different teams need to agree on a convention.
Nothing prevents that. In that moment, we achieved our goal. The ID of a message became meaningless, and naming discussions are eliminated :) |
@opral/inlang-cli @opral/inlang-cli @opral/inlang-fink @opral/inlang-ide-extension Please check the spreadsheet of terms we plan to use for human id's (i will share the link in discord). The table has a total of 4 tabs with different "adjectives", "nouns", "adverbs", "verbs". Please take 30 minutes to check the current words for. Pronounceability politically incorrect hurtful or negatively coannotated words spellings in British vs American English Just delete the ones where you see problems. If you unsure of one of those properties - its a reason enought to drop it - no discussion needed! Pleas only change column a. Column c and d will provide you with example ids including the term defined in a #excel_magic Please react to this comment with a rocked if you are done 🚀 |
@martin-lysk i pressed 🚀 because I thought ppl were excited. i doubt that people went through the spreadsheet https://docs.google.com/spreadsheets/d/1AsAgZi9V8R_5xxSK8-spp0mkLojlT-0MFVozcF0MZ6I. going through it now |
My notes:
Is it correct that
|
just change it |
I'll make a pass on this today since there's a cost to making changes to the word lists e.g. impacting mocks / tests.
|
conversation continues in https://linear.app/opral/issue/MESDK-12/human-readable-and-random-ids-for-messages-by-default |
Hey folks! I have some feedback on this feature. First of all I admit it's a brilliant idea to have random keys. No more bike-shedding on key names for "Close" vs "close" vs "close" (as not far) and stuff like that. I have some suggestions to make it even better, at least for my use cases. My first criticism is that the token names are long! Often longer than the few words they replace. That plus the hint takes a lot of screen estate. A second criticism, more related to my workflow, is that token names are of random length. It makes editing the JSON files by hand more exhausting than it should because the start of strings are not aligned. I would solve these two issues at once by embracing entropy: short and fully random identifiers. 8 random consonants have more entropy than the current 4 words. I'd love to have the extension autogenerate a short random identifier, whose length would be configurable (e.g. for a small app, 4 letters would be more than enough). What do you think? |
Hi @GauBen, We would love shorter random keys! Problem: Distributed system. In larger projects, 1000's of people will create messages in different branches. Each ID generation for the message must be unique. Otherwise, we need to handle ID conflicts (which will be a pain). If you develop a random human-readable ID system that will not lead to ID conflicts in large projects, we will quickly merge a PR!
Have you tried Sherlock or Fink? We believe that editing JSON files by hand will fade out once the tools become better, and rather invest time into making the tools better than trying to fix manual editing by hand. If you haven't used Sherlock or Fink, I'd like to know why. |
Thanks for your quick response! 🎅 How important is "human-readable"? Current identifiers are in English, which are not nearly as universal. Offering to generate random identifiers (like I'm absolutely not advocating to remove the current id system, it's great for many use-cases, I'm suggesting adding a new generator. Yes I use Fink, it's a great tool! For small updates (i.e. when the wording is too long for the UI) I favor updating the JSON files directly, the feedback loop is shorter. |
Important. Human readable enables saying "please change human-blue-moon" or searching for human-blue-moon. Current problem might be that we have 4 words instead of 3. We did that because the chances for 3 words were too high for a conflict. Solvable if we increase the word pool?
How could we improve Sherlock to remove the desire to manually edit JSON files? |
Problem
Proposal
Apps choose message IDs for users that are human-readable and memorizable but have no "meaning" by default.
Pros
Cons
The text was updated successfully, but these errors were encountered: