Sign in to follow this  
RadRussianRus

Name declensions in compendium

Recommended Posts

I'm currently working on improved version of Russian translation. As far as I saw from Polish, there is an agent name declension support for dialogs, but when I'm trying to use it in compendium, I get this (should be КАРТЫ САЛ, КАРТЫ РУКА и КАРТЫ СМИТА):
5R0G3MIo6h.png.1b0d6a5c08fbc07954c464e2c32bfddf.png

Or this (should be Познакомились с Альтой):
n9j6NZhOV7.png.41271d5c9ecf274ed5132c3de16e2497.png

Earlier there was a crash when I've tried to use {1#name_instrumental} instead of {1#agent#name_instrumental}. It was fixed in latest build, but it shows name in nominative declension.

Is there a way to get correct declension in compendium?

Share this post


Link to post
Share on other sites
RageLeague    1487

Yeah you can't do that under the current system, I think.

This is the code:

Spoiler

loc.format( LOC"UI.CARDCOMPENDIUM.AGENT_UNLOCKS_TT_MET", agent:GetName() )

 

As you can see, when formatting, it calls Agent:GetName before passing it to the formatter, so during formatting, your only info is the string rather than the agent, so you cannot apply declension functions to whatever you are looking at.

The reason why this is done is that declension functions like name_nominative also wraps the name around a tag, which highlights the string and gives it a tooltip. They probably don't want the highlight, so they called GetName before passing it into the formatter. Unfortunately, it has the side effect of not providing enough information regarding declensions.

Unfortunately, there's just way to many places where this happens for mods to be effective. You kinda just hope that the devs will fix this issue.

Share this post


Link to post
Share on other sites
RageLeague    1487

Actually, I have an idea that require very little modification to existing code. If you know how to code, you can define your own custom formatting function by assigning methods to the table called "loc".

I have no idea how declensions work because I don't speak a language that uses it, so I'll just use an example in English. Let's say you want to make a person's name be different in British English and American English. For example, let's say Nadan's British name is NaDan while Nadan's American name is NAedan. We translate Nadan into something like "NaDan|NAedan"(make up your own formatting if you like) and define two functions:

function loc.to_british (str)
  parts = str:split("|")
  if #parts == 2 then
    return parts[1]
  end
  return str
end

function loc.to_american (str)
  parts = str:split("|")
  if #parts == 2 then
    return parts[2]
  end
  return str
end

In that case, to use the British version of the name in the compendium, use "{1#to_british}" or whatever identifier it is used, and to use the American version, use "{1#to_american}". You might also want to override the "loc.agent" function so that it defaults to one version, but this can be worked on later.

I hope this make a little bit of sense. If not, you can make up a formatting you'd like and I can make up some code for you, if you want.

  • Like 1

Share this post


Link to post
Share on other sites

 

1 hour ago, RageLeague said:

Yeah you can't do that under the current system, I think.

This is the code:

  Hide contents


loc.format( LOC"UI.CARDCOMPENDIUM.AGENT_UNLOCKS_TT_MET", agent:GetName() )

 

As you can see, when formatting, it calls Agent:GetName before passing it to the formatter, so during formatting, your only info is the string rather than the agent, so you cannot apply declension functions to whatever you are looking at.

The reason why this is done is that declension functions like name_nominative also wraps the name around a tag, which highlights the string and gives it a tooltip. They probably don't want the highlight, so they called GetName before passing it into the formatter. Unfortunately, it has the side effect of not providing enough information regarding declensions.

Unfortunately, there's just way to many places where this happens for mods to be effective. You kinda just hope that the devs will fix this issue.

Yeah, I saw this code. I thought to replace the functions where it's used, but it's a bit too heavy.
 

50 minutes ago, RageLeague said:

Actually, I have an idea that require very little modification to existing code. If you know how to code, you can define your own custom formatting function by assigning methods to the table called "loc".

I have no idea how declensions work because I don't speak a language that uses it, so I'll just use an example in English. Let's say you want to make a person's name be different in British English and American English. For example, let's say Nadan's British name is NaDan while Nadan's American name is NAedan. We translate Nadan into something like "NaDan|NAedan"(make up your own formatting if you like) and define two functions:


function loc.to_british (str)
  parts = str:split("|")
  if #parts == 2 then
    return parts[1]
  end
  return str
end

function loc.to_american (str)
  parts = str:split("|")
  if #parts == 2 then
    return parts[2]
  end
  return str
end

In that case, to use the British version of the name in the compendium, use "{1#to_british}" or whatever identifier it is used, and to use the American version, use "{1#to_american}". You might also want to override the "loc.agent" function so that it defaults to one version, but this can be worked on later.

I hope this make a little bit of sense. If not, you can make up a formatting you'd like and I can make up some code for you, if you want.

That's more interesting though. I'm familliar with Lua, so I'll try to do it later. Thanks for the hint.

  • Potato Cup 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this