Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How can I add translation for months' names? #370

Open
JarisGV opened this issue Apr 18, 2021 · 6 comments
Open

How can I add translation for months' names? #370

JarisGV opened this issue Apr 18, 2021 · 6 comments

Comments

@JarisGV
Copy link

JarisGV commented Apr 18, 2021

Hello.

I'd like to type the date in 'title' in english i.e.: title="July 17, 2008" and I'd like to add the translation for the name of the 12 months in a script, i.e. July: "Julho", as we have in locale files, so when I set up the locale to portuguese the user would get the date not as July 17, 2008 but Julho 17, 2008.
Is there a way to do it?

Example

Translating months' names

Best regards.

@Sartharian
Copy link

@JarisGV
Copy link
Author

JarisGV commented May 5, 2021

I didn't find anything related to the name of the months in 'locale'.
I don't want to use short version like '1d, 1m...', I'd like to use the name of months but translated. I.e. (es) Enero 27... (fr) Janvier 27... (pt) Janeiro 27...

@JarisGV
Copy link
Author

JarisGV commented May 6, 2021

Okay, I just solve it by adding this code:

image,

View on CodePen

@Sartharian
Copy link

the locale js files adds a customization support for the relative time text!
u 're making a mistake, 'cause this plugins only converts the iso to a relative time text.
perhaps u're confusing w/ the examples...
the locale info comes from ur data or info actually showing.
no need to replace the eng notations :)

@Sartharian
Copy link

Sartharian commented May 8, 2021

in othr words, u can set the title attr w/ the text u wanna show... =)
<time class="timeago" datetime="[dateisoformat]" title="[Custom user text]">... and this text is edited from the plugin using the locales</time>

@JarisGV
Copy link
Author

JarisGV commented May 8, 2021

in othr words, u can set the title attr w/ the text u wanna show... =)
<time class="timeago" datetime="[dateisoformat]" title="[Custom user text]">... and this text is edited from the plugin using the locales</time>

But that's the problem. I wanna show the text in title attr in multiple languages.
I want to show it by default in english, but the user can define the language he will see (es, fr, pt...). That's the reason I translated the names of the months. Perhaps this is not the right way to do it, but the problem is solved, and sincerely I didn't find how to solve it using your instructions.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants