#can I get some how player main language?

1 messages · Page 1 of 1 (latest)

kind hamlet
#

Above

stray siren
#

what

kind hamlet
#

I wanna get it to localize action form

kind hamlet
stray siren
#

are you asking for the lang files

kind hamlet
arctic island
#

huh

unkempt drift
#

he want a way to get what language the player using in minecraft

unkempt drift
#

it is a client side info
so you probably can't

umbral rapids
#

%langkey%

hollow rock
#

Commands get affected by the langs chosen though...

kill @e[type=item,name="Coal"]
kill any item entities called Coal (and yes, it killed renamed Items and an actual minecraft:coal item)

This is affected by the langs in the settings. Since "Coal" can be different in each language, you can somewhat detect what language they use.

worthy forge
# kind hamlet Above

You can use a resource pack. If you check docs name of stuff in forms supports rawMessage meaning you can add custom message that will be displayed in the right language to people using the resource pack. Remember that you’ll need a translation for every language yo wanna add

kind hamlet
#

Got it

kind hamlet
split kiln
#

#1067869590400544869

north raven
#

hey! I have a similar question

#

I have something like this:javascript var textBlueprints = { translate: `test.word.blueprints` }; var translatedText = textBlueprints.translate; var testVar = `${translatedText == "Blueprints" ? scoreEnUS : translatedText == "Baupläne" ? scoreDeDE : translatedText == "Planos" ? scoreEsES : translatedText == "Plans" ? scoreFrFR : translatedText == "設計図" ? scoreJaJP : scorePtBR}`; here the variable testVar should take a different value (scoreEnUS, scoreDeDE, etc.) depending on the value of the translation of test.word.blueprints, that's depending on the language the game is using

#

but it's not working, I mean the variable testVar is always returning scorePtBR as value instead (that's it takes the last value of the condition, meaning that none condition is being met), does anyone know why?

I'm sure that test.word.blueprints have Blueprints as value inside the en_US.lang file, so when I'm using English (United States) language in game then test.word.blueprints should have Blueprints as value, so no idea why the conditions inside the variable testVar are not working 🤷

north raven
#

I see it's because translatedText is returning "test.word.blueprints", but why?

#

it should return the translation of `test.word.blueprints`

#

🤨

#

btw I'm working on stable

mighty wharf
#

translations only work once they're passed to the client, afaik

north raven
#

so there's no way to check what language is used in game?

mighty wharf
#

nope