Cms: [beta 34+ and 3.0.x] Cannot keep Markdown.php file in two different lang folders as it creates garbage in Fieldtypes view

Created on 6 Jul 2020  路  9Comments  路  Source: statamic/cms

Bug Description

I got some garbage related to Markdown when adding a first field to a new fieldset

How to Reproduce

  1. in my_base_site_folder/resources/lang/fr/ add a file called markdown.php
  2. Create a brand new Fieldset, then click on Create a field OR try to add any field to a blueprint

There isn't any problem when this markdown file is ONLY located in my_base_site_folder/vendor/statamic/cms/resources/lang/fr

Extra Detail


Capture d'茅cran 2020-07-06 18 06 34

Capture d'茅cran 2020-07-06 18 20 41

Environment

Statamic version: 3.0.0.-beta-{34}

PHP version: 7.{4.2}

Install method (choose one):

  • Fresh install from statamic/statamic

All 9 comments

Now solved....NOT

Sorry...It is apparently solved in 3.0.7 but when I update "my" French localisation files for the CP, I get this error back. So I have to reopen it.

And I just don't quite get why I have this problem...

OK, found the issue: see "How to reproduce" above

@ebeauchamps I've swapped my fresh Statamic install's locale in config/app.php to fr and created the file ( resources/lang/fr/markdown.php) but I'm unable to replicate the issue.

Should I be doing something else in order to replicate this?

Probably: you should display the CP in French I guess (in your user.yaml file, put

preferences:
  locale: fr

good to know: the markdown.php file I put in this folder is the same as the one found in the vendor folder
I did not have this issue before beta34 but I guess the /resources/lang folder should now remain empty (apart from the en folder)?

Thanks for your response! Although, I still can't seem to reproduce it... the text Markdown displays, which I think should be the case until something overrides it (correct me if I'm wrong).

image
image

Would you mind creating up a fresh Statamic site to reproduce the issue yourself and let me know if you still encounter the issue.

Sure! but later on, it's midnight here!! I'll let you know.

How to Reproduce

  1. in my_base_site_folder/resources/lang/fr/ add the markdown.php file already located in my_base_site_folder/vendor/statamic/cms/resources/lang/fr
  2. Create a brand new Fieldset, then click on Create a field OR try to add any field to a blueprint

There isn't any problem when this markdown.php file is ONLY located in my_base_site_folder/vendor/statamic/cms/resources/lang/fr

Capture d鈥櫭ヽran 2020-09-15 脿 22 13 42
Capture d鈥櫭ヽran 2020-09-15 脿 22 14 03

My personal analysis

When working on my translation updates, I put the working copy of my files in my_base_site_folder/resources/lang/
That includes my fr.json file and my fr folder

I am doing this in order to check for my translations as it should override the French files located in my_base_site_folder/vendor/statamic/cms/resources/lang/

Actually, I recently discovered that:

  1. the fr.json file is overrided
  2. the messages.php file is not overrided
  3. the markdown.php file (always fully identical between the 2 folders) is creating the above described garbage

My questions

  1. Is there any reason for keeping this particular folder my_base_site_folder/resources/lang/ in Statamic?
  2. What is it for?
  3. Why cannot we use it to override translations located in my_base_site_folder/vendor/statamic/cms/resources/lang/ ?
  4. As the above described behaviour is somewhat recent (beta34), what could be done?

The "json" translations are considered global. You can't override them in a vendor directory.
So you need to put it in resources/lang/fr.json. It's just the way Laravel works.

The other php based translation files _are_ specific to the vendor (Statamic), so you need to put them in resources/lang/vendor/statamic/fr/markdown.php.

However, if you're just trying to test out some translations that you plan to PR into Statamic, you could consider editing them in vendor/statamic/cms/resources/lang.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sauerbraten picture sauerbraten  路  3Comments

dakisan picture dakisan  路  4Comments

filipac picture filipac  路  4Comments

philippgrimm picture philippgrimm  路  3Comments

austenc picture austenc  路  3Comments