I’m not sure if I understood correctly but you can ignore things in your repo using .gitignore file (Google: .gitignore)
Here’s an example from bedrock: https://github.com/roots/bedrock/blob/master/.gitignore
I’m not sure if I understood correctly but you can ignore things in your repo using .gitignore file (Google: .gitignore)
Here’s an example from bedrock: https://github.com/roots/bedrock/blob/master/.gitignore
Sorry, I have expressed myself wrong. I mean a function that extends the .gitignore automatically based on the installed composer packages.
Ah, yes!
I usually ignore all and then add exceptions to files which to add. I don’t know anything which does this automatically though, this would nice feature.
Maybe you could start a hobby project which does all this
That would be interesting. Maybe later this year
Now I have a problem with the composer on a remote server. It loads any language files in the specified folder. The language folders are available or in the repository. On my local VM everything works.
Does anyone have an idea?
This is stunning, very helpful.
Does anybody know how to use this to make the admin in a different language? I’ve tried adding define('WPLANG', 'fr_FR');
in environments / development.php but with zero success, everything stays in english.
Hey!
Did you find answer to your problem?
I usually just use WP Native Dashboard in all instances. This allows your enduser to choose which language they want to use in dashboard. Then you don’t have to worry about forcing admin to any specific language.
Awesome thank you, will use that next time! (I just let it be in english for this one)
Sadly this won’t work with the default trellis configuration. By default composer runs with the
--no-scripts
flag which disables any composer scripts used by koodimoonni.
Thanks for pointing that out. It’s pretty easy to override that default hook file but it might be worth looking into to remove that specific option.
I think that --no-scripts is good for security especially for noobs. @swalkinshaw do you know if composer has option to allow specific script to run or specific package but deny all others? Like a whitelisting feature.
This might be pointless but anyone Is able to put harmless code in their composer packages and I guess that most users never look the code which is run in the implicit scripts like these language packages.
Don’t think that’s possible but you can always use composer run-script
to manually trigger them.
This is my current workaround for a trellis-bedrock project to get the great composer language dropin up and running. If anyone has a better approach, please share
--no-scripts
flag from trellis/roles/deploy/hooks/build-after.yml
. This enables composer to move the language files to the configured language directory. Note: imho we currently cannot use run-script
, because the dropin installer doesn’t support triggering scripts (yet).web/app/languages/*
to site/.gitignore
(or wherever your bedrock project is located)trellis/roles/deploy/defaults/main.yml
and add the following path to project_shared_children
project_shared_children:
[...]
- path: web/app/languages
src: languages
@o1y thanks for sharing this!
Two improvements/tips which both have to do with trying to avoid modifying “core” Trellis files:
roles/deploy/hooks/build-after.yml
and make your customizations there. Then define the new hook file as see here.project_shared_children
in your own group_vars
folder. Maybe group_vars/all/main.yml
This will make it easier to keep Trellis up to date (if that’s a concern of yours).
BREAKING CHANGES
This repository is now located in: https://wp-languages.github.io
I needed to change the address because composer changed and needs all repositories as https. I redirected https://languages.koodimonni.fi to the new repository as well, but please use https://wp-languages.github.io instead than my server.
This repository only contains translations for core and few selected plugins (mainly core plugins + woocommerce, bbpress). I added details in wp-languages.github.io repo if you want to manually add any translation zip into your project.
If you can run wp-cli in your deploy please consider using it’s language features:
$ wp core language install fi
Success: Language installed.
# Updates (or installs) all languages for core, plugins and themes.
# When I runned this I had jetpack installed but without any translations.
$ wp core language update
Updating 'Finnish' translation for Jetpack by WordPress.com 3.9.2...
Downloading translation from https://downloads.wordpress.org/translation/plugin/jetpack/3.9.2/fi.zip...
Translation updated successfully.
Success: Updated 1/1 translations.
It will contain every plugin translation package always. https://wp-languages.github.io can’t contain all translation data in it’s current form, but if you only need core translations it is a really handy tool.
@Koodimonni, thank you for your work!
If anyone wants to integrate the WP-CLI way into their deployments, I posted my workflow here:
Thanks @Koodimonni for your great work. I noticed some strange behaviour though:
When switching to any other language but english (tried de and fr), the visual post editor will not show since the language files for tinymce are missing.
Am I missing something or should they be added to the packages?
Wordpress expects them to be in web/wp/wp-includes/js/tinymce/langs
. However, with "koodimonni-language/core-de_de"
for example, I am not getting any other languages installed there except the default wp-langs-en.js
.
Here’s a screenshot on how to reproduce this:
I haven’t installed anything extra besides the language packages from my composer packages.
Here’s a screenshot from finnish koodimonni-language/core-fi
package in chrome:
So because it works for me I can’t really easily debug this for you.
If you really want my help please start an issue in Github instead rather than posting over here.
The example behind your link doesn’t work .
The dropin-paths don’t match the ones in your post.
I can’t get it to work at all. What would a working composer.json look like and where would the languages be installed?