Open wbazant opened 22 hours ago
Here's a slightly imperfect one liner that finds all translations in the source code:
find src -type f | xargs perl -nE 'say for m{t\((?:['"'"'"])(.+?)(?:['"'"'"])}g' | grep -v '^/' | sort -u
and this one (assuming we are still in a directory falling-fruit-web
, and there's a falling-fruit
directory next to it) prints all keys in the yaml:
perl -MYAML::XS -e 'sub print_keys { my ($data, $prefix) = @_; if (ref($data) eq "HASH") { foreach my $key (keys %$data) { if (!ref($data->{$key})) { print "$prefix$key\n"; } print_keys($data->{$key}, "$prefix$key."); } } elsif (ref($data) eq "ARRAY") { foreach my $index (0 .. $#{$data}) { print_keys($data->[$index], "$prefix$index."); } } } print_keys(YAML::XS::LoadFile($ARGV[0]), "");' ../falling-fruit/config/locales/en.yml | perl -nE 'say $1 if /en\.(.*)/' | sort
Combining both, and printing in a three-column format for just beta site, just live site, and shared keys:
comm <( find src -type f | xargs perl -nE 'say for m{t\((?:['"'"'"])(.+?)(?:['"'"'"])}g' | grep -v '^/' | sort -u ) <( perl -MYAML::XS -e 'sub print_keys { my ($data, $prefix) = @_; if (ref($data) eq "HASH") { foreach my $key (keys %$data) { if (!ref($data->{$key})) { print "$prefix$key\n"; } print_keys($data->{$key}, "$prefix$key."); } } elsif (ref($data) eq "ARRAY") { foreach my $index (0 .. $#{$data}) { print_keys($data->[$index], "$prefix$index."); } } } print_keys(YAML::XS::LoadFile($ARGV[0]), "");' ../falling-fruit/config/locales/en.yml | perl -nE 'say $1 if /en\.(.*)/' | sort ) | grep pages
pages.about.about_the_site
pages.about.advisors
pages.about.alan_gibson_bio_html
pages.about.ana_carolina_bio_html
pages.about.caleb_phillips_bio_html
pages.about.celebration
pages.about.closing_remarks
pages.about.closing_remarks_para1_html
pages.about.closing_remarks_para2_html
pages.about.closing_remarks_para3_html
pages.about.contact_us_html
pages.about.craig_durkin_bio_html
pages.about.cristina_rubke_bio_html
pages.about.david_craft_bio_html
pages.about.directors
pages.about.emily_sigman_bio_html
pages.about.ethan_welty_bio_html
pages.about.ff_disclaimer_html
pages.about.give_gratipay
pages.about.give_paypal
pages.about.give_us_money
pages.about.jeff_wanner_bio_html
pages.about.join_us_html
pages.about.more_about_html
pages.about.staff
pages.about.translate
pages.about.translate_for_us_html
pages.about.translators
pages.about.tristram_stuart_bio_html
pages.about.write
pages.data
pages.data.beware_html
pages.data.caveat_emptor_html
pages.data.data_unavailable_html
pages.data.intro
pages.data.license_html
pages.datasets.community_map
pages.datasets.date_imported
pages.datasets.google_fusion_table
pages.datasets.google_map
pages.datasets.google_maps_engine
pages.datasets.intro_html
pages.datasets.no_license
pages.datasets.table_info
pages.datasets.type
pages.datasets.types_of_data
pages.data.summary_description
pages.data.summary_of_sources
pages.press
pages.project
pages.sharing
pages.sharing.ample_harvest
pages.sharing.food_banks
pages.sharing.food_banks_canada
pages.sharing.food_banks_intro
pages.sharing.global_foodbanking_network
pages.sharing.grow_pick_and_distribute
pages.sharing.intro_html
We have translations for lots of different verbiage accompanying functionality on the live site, and before we start asking volunteers for new translations, we want to make sure we have leveraged what we have. Additionally, comparing translation keys is going to help us track progress for the beta release milestone - things like a little help icon somewhere on the live site that will still be useful on the beta site.
This epic will conclude where for each translation key on the live site ( currently 354 of them ) we'll either have it on the beta site, or we'll tie it to a feature that we're consciously not carrying forward. We can also stop when the epic no longer helps us identify changes worth making to the beta site :).