Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

i18n translations#497

Closed
gmarcos87 wants to merge 5 commits into
ssbc:intlfrom
gmarcos87:intl
Closed

i18n translations#497
gmarcos87 wants to merge 5 commits into
ssbc:intlfrom
gmarcos87:intl

Conversation

@gmarcos87

@gmarcos87 gmarcos87 commented Apr 12, 2017

Copy link
Copy Markdown
Contributor
  • Extract rest of English strings into i18n format()
  • Autodetect language
  • Dates and numbers

#485

@gmarcos87 gmarcos87 changed the title Intl i18n translations Apr 12, 2017
ids = Array.from(ids)
var featuredIds = ids.slice(-4).reverse()

if (ids.length) {

@ahdinosaur ahdinosaur Apr 12, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @gmarcos87, did you know intl-messageformat which i used in patch-intl, has syntax for plural messages? https://formatjs.io/guides/message-syntax/#plural-format

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should be able to pass in a second argument to format which is an object of values you can reference in the translation templates.

@ahdinosaur

Copy link
Copy Markdown
Contributor

[ ] Autodetect language

i tried to set this up, but didn't really test it. so, does it not work for you?

@ahdinosaur

Copy link
Copy Markdown
Contributor

by the way, this is awesome!

Comment thread locales/en.js
assignedDescriptionTo : "assigned a description to",
subscribedTo : "subscribed to",
unsubscribedFrom : "unsubscribed from"
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a developer perspective it would be nice if these key/values were "sorted". Just my 2 cents :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are in the order they appear in the code, to make the extraction easier. In the next pull I order them. Thank you!

Comment thread locales/en.js Outdated
writeMessageChannel : "Write a message in this channel\n\n\n\nPeople who follow you or subscribe to this channel will also see this message in their main feed.\n\nTo create a new channel, type the channel name (preceded by a #) into the search box above. e.g #cat-pics",
writePrivate : "Write a private reply",
writePublic : "Write a public reply",
cannotLoadThead : "Cannot load thead",

@ralphtheninja ralphtheninja Apr 12, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be cannotLoadThread: "Cannot load thread"?


api.sbot.async.get(id, (err, value) => {
if (err) return result.set(h('div', {className: 'Error'}, ['Cannot load thead']))
if (err) return result.set(h('div', {className: 'Error'}, [format('cannotLoadThead')]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannotLoadThread

patchwork/pull/485/commits/e9cd1866e71358295790fabd3ad823b05e1f59a5
@ahdinosaur

Copy link
Copy Markdown
Contributor

hey @gmarcos87, this is looking great. what's the status on this pull request? is there anything your blocked on, or something you want help with?

@gmarcos87

Copy link
Copy Markdown
Contributor Author

I have a busy week of work and not be able to make changes in the code. I'm sorry, maybe the next week would work on it.

@ahdinosaur

Copy link
Copy Markdown
Contributor

@gmarcos87 no worries, take care of yourself. 😸

@gmarcos87

Copy link
Copy Markdown
Contributor Author

Ok, I'm back. I updated pull request #527 to the current master code. You can see de code in https://github.com/gmarcos87/patchwork/tree/i18n-reload. I extract the strings of the different screens and add the Spanish language. The automatic detection of language and the "moment" configuration are pending.
In the previous pull request (#497) I was using depject and format. Here I continued @dangerousbeans work done on i18n. What approach do you think is best?

I'm really interested in getting a multi-language version. I want to propose the use in my community and not all speak English.

@dominictarr

Copy link
Copy Markdown
Contributor

we should really get one of these merged, I think it's better to use depject, but it should be simple to convert @dangerousbeans's approach to depject

@gmarcos87

Copy link
Copy Markdown
Contributor Author

Close in favor of #632

@gmarcos87 gmarcos87 closed this Sep 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants