Name according to language

in multilanguage section of learn.getgrav, ther an example with the month of the year:

en:
  MONTHS_OF_THE_YEAR: [January, February, March, April, May, June, July, August, September, October, November, December]

Could you precise in which document is it extract from?
(I guess it is probably a yaml file but it can’t find out which one

I have a problem with variables according to languages:

For instance, I would like the japanese blog section to have date in japanese:

  1. I have looked at the template and see perfectly that ther is a variable d for day and another M for month (code: see below) but I can’t find out how to.
    —html
    {{ page.date|date(“d”) }}
    {{ page.date|date(“M”) }}

2. I precised that I have made all the changes possible in `system/languages/` with `fr.yaml` or `ja.yaml` (created for the purpose) and also in `user/languages/` with the same `fr.yaml` or `ja.yaml`, without result.

here the file's redaction of `fr.yaml`for checking:
folowing exem ple of [multilanguage section of learn.getgrav](http://learn.getgrav.org/content/multi-language):
`MONTHS_OF_THE_YEAR: [Janvier, Fevrier, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Decembre]`,
exactly same redaction as the standart system Grav file _plus_ the previous line repeated at 2 differents indention level:
- first one at same level of indention than other date variable,
- second on the above primary level.
That's gives this:
DEC_PLURAL: d
MONTHS_OF_THE_YEAR: [Janvier, Fevrier, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Decembre]

MONTHS_OF_THE_YEAR: [Janvier, Fevrier, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Decembre]

I have the same problem for display my name correctly in each language.

I have first wrote in user/config/site.yaml

name:
   -fr: 'François Vidit'
   - ja: 'Francois Vidit (フランソワ・ヴィディ)'
   - en: 'Francois Vidit'

on the model given in leanr.getgrav.org

but

it’s provocating an error with the feed atom plugin that cannot handle these definitions.

Thank you in advance for your help

That on the Learn site is just an example.

‘d’ and ‘M’ are PHP date formats, used to print the day or the month, nothing to do with the translations.

The theme is not configured to translate the dates, so you can just edit {{ page.date|date("M") }} to {{ page.date|date("M")|t }} (notice |t which means “translate”) and add to your language file

Jan: month-name-in-japanese
Feb: month-name-in-japanese

Do not add them under system/languages/ but under user/languages/

I am sorry, I cannot manage to get to the any of the 2 points (fr and ja):

here are the two lines the way they are now:
—html

{{ page.date|date(“d”)|t }}
{{ page.date|date(“M”)|t }}


then, in `user/languages` changes were made for `fr.yaml` this way:
(I started by french because it is originally set in Grav therefore easier).
*1* (recommanded way)
`Jan: Jan`
`Feb: Fév`
etc ...
no result

*2* (as other variables are set that way)
`JAN: 'Jan'`
`FEV: 'Fév'`
etc ... 
no result

*3* (as other variables are set that way)
`'Jan': 'Jan'`
`'Feb': 'Fév'`
etc ...
no result

*4* (try, as in result text displayed is uppercase)
`'JAN': 'JAN'`
`'FEV': 'FÉV'`
etc ...
no result

What's the problem?

Please help

The first approach works for me (I assume multilanguage is enabled on the site)

Please, tell me more so that I can reach the point!

here is the fr.yaml document the way it is now in user/languages:

Feb: Fév
Apr: Avr
May: Mai
Jun: Jui
Jul: Jui
Aug: Aoû
Dec: Déc

unfortunately, no result!

Jan, Mar, Sep, Oct, Nov are actually same in en and fr so not needed.

Please tell me how you had it written to work.

Thanks in advance

in the above code, these are the only strings of the whole fr.yalm document in user/languages

I mean, there is nothing that says fr there…

how can i indicate to twig translation filter |tin _blog.item.html.twig that the translation is to be made to fr therefore fr.yaml ?

the |t twig filter will automatically use the current active language. There is no need to tell it which one that is.

☆ Thank you very much for reply: I have tried hard to get to the point but yet not possible (it is one o’clock at night in France so feeling now very tired also probably)… ♪

In your opinion, what could possibly the difficulty?

I precise: my default language is fr, then comes ja in second, then en in third.

Strangely, with _blog.item.html.twig, whatever I do in fr.yaml, it’s like nothing… My dates are still en

my post appears 3 times!!!

Perhaps tomorrow you can provide a zip of your site for us to look at and inspect, and that will make things clearer :slight_smile:

ok how should I do?

just zip it up, stick it on dropbox or something, and send us a link to devs (at) getgrav.org

☆ I really apreciate the support / help ♪ with time difference it’s better to do it before sleeping may be… Understood
Again, thank you for assistance…

♪ sent! ☆ Bonne nuit !

@rhukster:

I am very proud to tell you that I finally solve the yesterday problem on date (how painful it has been!).

The issue was that I was working on template _blog_item.html.twig and the html page on another template blog_item.html.twig

Now I got to the point, having my date in fr and ja and japanese just the way it has to be.

Previous reply on italian footer with what you explained about definition of constant that made me translate my footer and from there try again on dates.

Could not understand why it would not work as I was doing similar, I erased the code and realised it was NOT the right template … It’s stupid but finally …

Thank you again for your help

Glad you got it sorted!