开发者

Gettext genitive

开发者 https://www.devze.com 2023-04-11 08:53 出处:网络
Let\'s say I want to display the following text to the user: \"John\'s car\" I\'m using gettext to output it:开发者_Go百科

Let's say I want to display the following text to the user:

"John's car"

I'm using gettext to output it:开发者_Go百科

sprintf(_("%s's car"), $firstName)

The obvious problem is that, if the first name of the user ends in an S, we'll get something like this:

"James's car" (should be "James' car")

How do I solve that problem, especially considering that other languages might pose a similar challenge (different genitives depending on word ending or similar)?


Simply put: write a function with an explicit if to get the genitive form for a name, and print that instead. I'd provide an example but you haven't indicated what language we're talking about!

0

精彩评论

暂无评论...
验证码 换一张
取 消