-
Notifications
You must be signed in to change notification settings - Fork 23
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
Generate always available name for a new website #900
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of suggestions.
I think adding a postfix is an improvement 💪
In addition to this, we could increase our list of default sitenames by having a really long list of adjetives produced by an LLM and then use something like sprintf( __( 'My %s Website' ), adjetive )
,
src/lib/generate-site-name.ts
Outdated
} | ||
|
||
export const sanitizeFolderName = ( filename: string ) => { | ||
const LATIN = 'a-z'; | ||
const CYRILLIC = 'а-яё'; | ||
const ARABIC = '\\u0600-\\u06FF'; | ||
const HEBREW = '\\u0590-\\u05FF'; | ||
const HEREW = '\\u0590-\\u05FF'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is not intentional.
while ( usedSiteNames.includes( `${ randomName } ${ postfix }` ) ) { | ||
postfix++; | ||
} | ||
return `${ randomName } ${ postfix }`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we take into account RTL languages ? For those languages the postfix should be on the left.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to always use My WordPress Website
for subsequent names with the number, so user who uses all random names will keep getting My WordPress Website 1
, My WordPress Website 2
and so on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally for me, it's one more good option. And I don't see any pros/cons, anyway it's more kinda "Temporary name", 99% that the user will change it to something connected with their website, unless it's testing site.
Only one good thing what I see with the current approach is that we have diversity of names 😅
So I would go with either proposed approach by me or remove all adjectives and keep only My WordPress Website ${number}
. But I am ok with any approach, as long as we provide unique names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE, Oh, I guess you meant exactly to use only subsequent names of My WordPress Website
and remove adjective options, right? If so, ignore my previous message and I think that it's good simple approach too, I don't have strong preference either to use it or keep proposed by me.
while ( usedSiteNames.includes( `${ randomName } ${ postfix }` ) ) { | ||
postfix++; | ||
} | ||
return `${ randomName } ${ postfix }`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to always use My WordPress Website
for subsequent names with the number, so user who uses all random names will keep getting My WordPress Website 1
, My WordPress Website 2
and so on?
} | ||
|
||
const randomName = siteNames[ Math.floor( Math.random() * siteNames.length ) ]; | ||
let postfix = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be suffix
instead of postfix
? Or just a siteNumber
to ensure it makes sense for LTR and RTL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be suffix instead of postfix? Or just a siteNumber to ensure it makes sense for LTR and RTL?
If we make it as suffix, then it will be confusing for LTR environments, since we used to see number at the end (e.g. in MacOS, Windows).
So my opinion, we should change postfix with suffix only for RTL.
WDYT?
Proposed Changes
When you run out of available names, there is very weird result: after clicking "Add site" button we immediately see the next:
![Screenshot 2025-02-06 at 12 08 34](https://private-user-images.githubusercontent.com/5598437/410449009-d52a619e-9858-45d2-8e35-70a1a4b6780d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMTY1NDksIm5iZiI6MTczOTIxNjI0OSwicGF0aCI6Ii81NTk4NDM3LzQxMDQ0OTAwOS1kNTJhNjE5ZS05ODU4LTQ1ZDItOGUzNS03MGExYTRiNjc4MGQucG5nP1gtQW16LUFsZ29yaXRob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Ftei1TaWduZWRIZWFkZXJzPWhvc3QifQ.sf9WCNzVPuA8qhLy3wws1Gbq52Ameh_EEG1JiCDyTvA)
With this PR, the generation of names is always successful (we add numeric postfix), so users don't need to do extra actions and spend time to figure out "what is going on" .
Testing Instructions
Apply the next diff:
My WordPress Website
and create itMy Bold Website
andMy Bright Website