Skip to content

Added an extraction of the language setting from cookies#1097

Open
sergei-bondarenko wants to merge 4 commits intoHelloZeroNet:masterfrom
sergei-bondarenko:master
Open

Added an extraction of the language setting from cookies#1097
sergei-bondarenko wants to merge 4 commits intoHelloZeroNet:masterfrom
sergei-bondarenko:master

Conversation

@sergei-bondarenko
Copy link
Copy Markdown
Contributor

@sergei-bondarenko sergei-bondarenko commented Aug 25, 2017

#688
If the user doesn't have language setting in his cookies then value from the zeronet.conf will be used.

@HelloZeroNet
Copy link
Copy Markdown
Owner

The problem is the Translate object is shared between users, so if you change it to someone, then it will change to everyone who currently connected via websocket.

@sergei-bondarenko
Copy link
Copy Markdown
Contributor Author

@HelloZeroNet So the translation must be comletely moved to the frontend -- rewritten in javascript. Do you think it will be the clearest solution too?

@HelloZeroNet
Copy link
Copy Markdown
Owner

i'm not sure how would parametized translations (eg.: Change it to {auth_type}/{auth_user_name}@{domain} or Content publish queued for {0:.0f} seconds.) would work that way

@sergei-bondarenko
Copy link
Copy Markdown
Contributor Author

sergei-bondarenko commented Sep 2, 2017

@HelloZeroNet What if the websocket will send messages in English and then we translate it via simple substitution in JS that will not touch parametrized output at all. Something like this:

(this is javascript code below)
>> str = "Change it to {auth_type}/{auth_user_name}@{domain}"
>> str = str.replace("Change it to", "Változtatás")
>> print(str)
"Változtatás {auth_type}/{auth_user_name}@{domain}"

>> str = "Content publish queued for {0:.0f} seconds."
>> str = str.replace("Content publish queued for", "Tartalom publikálása elhalasztva")
>> str = str.replace("seconds", "másodperccel")
>> print(str)
"Tartalom publikálása elhalasztva {0:.0f} másodperccel."

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants