Skip to content

Bundle does not work properly with new Intl ICU translations #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jan 23, 2023
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b020360
Remove both "normal" and ICU domain from messages set
snpy Aug 24, 2021
d4c78c2
Add new configuration for new message format
snpy Aug 24, 2021
3952ec8
Add new field and getter based on recently added new config option
snpy Aug 24, 2021
bdad565
Make sure importer is ICU format aware
snpy Aug 24, 2021
c7284ed
Make sure new_message_format configuration is defined
snpy Aug 24, 2021
ab6631d
Pass to converter new_message_format configuration
snpy Aug 24, 2021
bd68a10
Make sure importer is aware of ICU domain format
snpy Aug 24, 2021
6429fb4
Let code "breath" a bit
snpy Aug 24, 2021
ef9c691
Make sure we're always aware of ICU domain
snpy Aug 24, 2021
af20898
Make sure we're aware of 3 different message domains
snpy Aug 24, 2021
04a1f1e
Persist PHP CS Fixer changes
snpy Aug 30, 2021
0b1317a
Merge pull request #2 from php-translation/master
snpy Nov 24, 2022
c040dab
Remove both "normal" and ICU domain from messages set
snpy Aug 24, 2021
1e88a37
Add new configuration for new message format
snpy Aug 24, 2021
a383c24
Add new field and getter based on recently added new config option
snpy Aug 24, 2021
5b321e1
Make sure importer is ICU format aware
snpy Nov 24, 2022
a39113e
Make sure new_message_format configuration is defined
snpy Aug 24, 2021
592b8f2
Pass to converter new_message_format configuration
snpy Aug 24, 2021
c3dbe3b
Make sure importer is aware of ICU domain format
snpy Aug 24, 2021
ee0cc66
Let code "breath" a bit
snpy Aug 24, 2021
d3b44d9
Make sure we're always aware of ICU domain
snpy Nov 24, 2022
1c7da76
Make sure we're aware of 3 different message domains
snpy Aug 24, 2021
8802b6f
Persist PHP CS Fixer changes
snpy Aug 30, 2021
b4b4f5a
Merge branch 'handle-icu-domain' of github.com:kram-soft/symfony-bund…
snpy Nov 24, 2022
f2e80e0
Apply PHP CS fixer automated fix
snpy Nov 24, 2022
bc9bd5f
Fix main PHPUnit issue
snpy Nov 24, 2022
1e099ec
Fix catalogue counter
snpy Nov 24, 2022
4116221
Make assertion more wordy
snpy Nov 24, 2022
cabf00a
Update configuration to have passing tests
snpy Nov 24, 2022
0c31b96
Merge pull request #3 from php-translation/master
snpy Jan 11, 2023
202af61
Merge branch 'master' into handle-icu-domain
snpy Jan 11, 2023
4c52eec
Apply PHP-CS-Fixer suggestion
snpy Jan 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add new configuration for new message format
It will allow us to control if we want to use new ICU format (with
suffixed domain with "+intl-icu") or format.

Configuration has normalizer (making sure string is in lower case) and
validator (making sure it's a string and either "" or "icu").

Setting `new_message_format: ""` we'll end up with new translations in
container like: {domain}.{locale}.{ext}.
Setting `new_message_format: "icu"` we'll end up with new translations
in container like: {domain}+intl-icu.{locale}.{ext}.

#300
  • Loading branch information
snpy committed Nov 24, 2022
commit 1e88a3784b60f7d977ece1663f7306442733b030
22 changes: 22 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,28 @@ private function configsNode(ArrayNodeDefinition $root): void
->scalarNode('output_dir')->cannotBeEmpty()->defaultValue('%kernel.project_dir%/Resources/translations')->end()
->scalarNode('project_root')->info("The root dir of your project. By default this will be kernel_root's parent.")->end()
->scalarNode('xliff_version')->info('The version of XLIFF XML you want to use (if dumping to this format).')->defaultValue('2.0')->end()
->scalarNode('new_message_format')
->info('Use "icu" to place new translations in "{domain}+intl-icu.{locale}.{ext}" container')
->defaultValue('icu')
->beforeNormalization()
->ifTrue(
function ($format) {
return \is_string($format);
}
)
->then(
function (string $format) {
return \strtolower($format);
}
)
->end()
->validate()
->ifTrue(function ($value) {
return !\is_string($value) || !\in_array($value, ['', 'icu']);
})
->thenInvalid('The "new_message_format" must be either: "" or "icu"; got "%s"')
->end()
->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think naming this parameter use_icu_format as a boolean is better here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now we have 2 formats; later we may have more (though with pace of changes and ICU capability I guess we'd have to wait for at least a decade to have something new).

It's just future proof option; however I do not have any problems with replacing this with a bool configuration.

One remark here - the name does not reflect the its nature (it may suggest all translations will be casted to ICU format; for now it just places new translations in ICU formatted file).

->variableNode('local_file_storage_options')
->info('Options passed to the local file storage\'s dumper.')
->defaultValue([])
Expand Down