@@ -3651,6 +3651,35 @@ Feature: Generate a POT file of a WordPress project
3651
3651
msgid "Black"
3652
3652
"""
3653
3653
3654
+ Scenario : Skips theme.json file if excluding it
3655
+ Given an empty foo-theme directory
3656
+ And a foo-theme/theme.json file:
3657
+ """
3658
+ {
3659
+ "version": "1",
3660
+ "settings": {
3661
+ "color": {
3662
+ "palette": [
3663
+ { "slug": "black", "color": "#000000", "name": "Black" }
3664
+ ]
3665
+ }
3666
+ }
3667
+ }
3668
+ """
3669
+
3670
+ When I try `wp i18n make-pot foo-theme --exclude=theme.json`
3671
+ Then STDOUT should be:
3672
+ """
3673
+ Success: POT file successfully generated.
3674
+ """
3675
+ And the foo-theme/foo-theme.pot file should exist
3676
+ But the foo-theme/foo-theme.pot file should not contain:
3677
+ """
3678
+ msgctxt "Color name"
3679
+ msgid "Black"
3680
+ """
3681
+
3682
+
3654
3683
Scenario : Extract strings from the top-level section of theme.json files
3655
3684
Given an empty foo-theme directory
3656
3685
And a foo-theme/theme.json file:
@@ -3756,7 +3785,13 @@ Feature: Generate a POT file of a WordPress project
3756
3785
"""
3757
3786
3758
3787
Scenario : Extract strings from style variations
3759
- Given an empty foo-theme/styles directory
3788
+ Given an empty foo-theme directory
3789
+ And a foo-theme/style.css file:
3790
+ """
3791
+ /*
3792
+ Theme Name: foo theme
3793
+ */
3794
+ """
3760
3795
And a foo-theme/styles/my-style.json file:
3761
3796
"""
3762
3797
{
@@ -3774,7 +3809,7 @@ Feature: Generate a POT file of a WordPress project
3774
3809
}
3775
3810
}
3776
3811
"""
3777
- And a foo-theme/incorrect/ styles/my-style .json file:
3812
+ And a foo-theme/styles/deeply/nested/variation .json file:
3778
3813
"""
3779
3814
{
3780
3815
"version": "1",
@@ -3791,9 +3826,26 @@ Feature: Generate a POT file of a WordPress project
3791
3826
}
3792
3827
}
3793
3828
"""
3829
+ And a foo-theme/incorrect/styles/my-style.json file:
3830
+ """
3831
+ {
3832
+ "version": "1",
3833
+ "settings": {
3834
+ "blocks": {
3835
+ "core/paragraph": {
3836
+ "color": {
3837
+ "palette": [
3838
+ { "slug": "red", "color": "#ff00000", "name": "Red" }
3839
+ ]
3840
+ }
3841
+ }
3842
+ }
3843
+ }
3844
+ }
3845
+ """
3794
3846
3795
3847
When I try `wp i18n make-pot foo-theme`
3796
- Then STDOUT should be :
3848
+ Then STDOUT should contain :
3797
3849
"""
3798
3850
Success: POT file successfully generated.
3799
3851
"""
@@ -3803,10 +3855,15 @@ Feature: Generate a POT file of a WordPress project
3803
3855
msgctxt "Color name"
3804
3856
msgid "Black"
3805
3857
"""
3806
- And the foo-theme/foo-theme.pot file should not contain:
3858
+ And the foo-theme/foo-theme.pot file should contain:
3807
3859
"""
3860
+ msgctxt "Color name"
3808
3861
msgid "White"
3809
3862
"""
3863
+ And the foo-theme/foo-theme.pot file should not contain:
3864
+ """
3865
+ msgid "Red"
3866
+ """
3810
3867
3811
3868
Scenario : Extract strings from the patterns directory
3812
3869
Given an empty foo-theme/patterns directory
@@ -3972,3 +4029,71 @@ Feature: Generate a POT file of a WordPress project
3972
4029
"""
3973
4030
msgid "foo-plugin/longertests/foo-plugin.php"
3974
4031
"""
4032
+
4033
+ Scenario : Extract strings from theme.json files in any level
4034
+ Given an empty foo-project directory
4035
+ And a foo-project/theme.json file:
4036
+ """
4037
+ {
4038
+ "version": "1",
4039
+ "title": "My style variation",
4040
+ "description": "My style variation description"
4041
+ }
4042
+ """
4043
+
4044
+ And a foo-project/nested/theme.json file:
4045
+ """
4046
+ {
4047
+ "version": "1",
4048
+ "title": "Nested style variation",
4049
+ "description": "Nested style variation description"
4050
+ }
4051
+ """
4052
+
4053
+ And a foo-project/nested/notatheme.json file:
4054
+ """
4055
+ {
4056
+ "version": "1",
4057
+ "title": "Not extracted style variation",
4058
+ "description": "Not extracted style variation description"
4059
+ }
4060
+ """
4061
+
4062
+ When I try `wp i18n make-pot foo-project`
4063
+ Then STDOUT should be:
4064
+ """
4065
+ Success: POT file successfully generated.
4066
+ """
4067
+ And the foo-project/foo-project.pot file should exist
4068
+ And the foo-project/foo-project.pot file should contain:
4069
+ """
4070
+ #: theme.json
4071
+ msgctxt "Style variation name"
4072
+ msgid "My style variation"
4073
+ """
4074
+ And the foo-project/foo-project.pot file should contain:
4075
+ """
4076
+ #: theme.json
4077
+ msgctxt "Style variation description"
4078
+ msgid "My style variation description"
4079
+ """
4080
+ And the foo-project/foo-project.pot file should contain:
4081
+ """
4082
+ #: nested/theme.json
4083
+ msgctxt "Style variation name"
4084
+ msgid "Nested style variation"
4085
+ """
4086
+ And the foo-project/foo-project.pot file should contain:
4087
+ """
4088
+ #: nested/theme.json
4089
+ msgctxt "Style variation description"
4090
+ msgid "Nested style variation description"
4091
+ """
4092
+ And the foo-project/foo-project.pot file should not contain:
4093
+ """
4094
+ msgid "Not extract style variation"
4095
+ """
4096
+ And the foo-project/foo-project.pot file should not contain:
4097
+ """
4098
+ msgid "Not extracted style variation description"
4099
+ """
0 commit comments