Skip to content

Add new file in i18n#7917

Merged
Alkarex merged 1 commit intoFreshRSS:edgefrom
aledeg:fix/add-i18n-key
Sep 5, 2025
Merged

Add new file in i18n#7917
Alkarex merged 1 commit intoFreshRSS:edgefrom
aledeg:fix/add-i18n-key

Conversation

@aledeg
Copy link
Member

@aledeg aledeg commented Sep 5, 2025

When manipulating I18N files, it is now possible to add a new file to all
languages. This action is available both in the manipulation script and
the makefile.

Changes proposed in this pull request:

  • add a new translation file from cli

How to test the feature manually:

  1. create a new i18n file from cli or make (ex: xxx.php)
  2. validate that the xxx.php file is created empty.

Pull request checklist:

  • clear commit messages
  • code manually tested
  • unit tests written (optional if too hard)
  • documentation updated

Additional information can be found in the documentation.

@Frenzie
Copy link
Member

Frenzie commented Sep 5, 2025

When supplied with an unknown root key, we expect to create a new i18n file instead of raising an exception.

Should it do both? Otherwise in case of a typo you'd suddenly have a completely new language to delete. So an exception unless run with -c (for create), for example.

@aledeg
Copy link
Member Author

aledeg commented Sep 5, 2025

It does not create a new language. It creates a new translation file alongside conf.php, sub.php, etc for all languages.

If there is a typo, I think it's easy to revert with a simple command like find app/i18n -iname \*xxx.php* -delete if we've created xxx.php files.

@aledeg
Copy link
Member Author

aledeg commented Sep 5, 2025

If you try to update a key with an unknown root key, you still have the exception.

@Frenzie
Copy link
Member

Frenzie commented Sep 5, 2025

If there is a typo, I think it's easy to revert with a simple command like find app/i18n -iname *xxx.php* -delete if we've created xxx.php files.

I don't mean from that perspective, but from the perspective of not noticing for 10 minutes and suddenly needing to try to merge conf.php and comf.php

@aledeg
Copy link
Member Author

aledeg commented Sep 5, 2025

If there is a typo, I think it's easy to revert with a simple command like find app/i18n -iname xxx.php -delete if we've created xxx.php files.

I don't mean from that perspective, but from the perspective of not noticing for 10 minutes and suddenly needing to try to merge conf.php and comf.php

I see what you mean. I'll figure something else.

@aledeg aledeg marked this pull request as draft September 5, 2025 13:22
@Alkarex Alkarex added this to the 1.27.1 milestone Sep 5, 2025
@Alkarex Alkarex added I18n 🌍 Translations CLI Command line interfaces in ./cli labels Sep 5, 2025
@aledeg aledeg force-pushed the fix/add-i18n-key branch 2 times, most recently from b832f10 to 88d2a8a Compare September 5, 2025 14:30
@aledeg aledeg changed the title Fix i18n add key feature when the root key does not exist Add new file in i18n Sep 5, 2025
@aledeg aledeg marked this pull request as ready for review September 5, 2025 14:32
When manipulating I18N files, it is now possible to add a new file to all
languages. This action is available both in the manipulation script and
the makefile.
@aledeg
Copy link
Member Author

aledeg commented Sep 5, 2025

@Frenzie I've change the whole thing to introduce an add-file feature. This way, there is no side-effect on other section of the code.

@Frenzie
Copy link
Member

Frenzie commented Sep 5, 2025

Sounds good to me. 👍

@Alkarex Alkarex merged commit de624dc into FreshRSS:edge Sep 5, 2025
1 check passed
@aledeg aledeg deleted the fix/add-i18n-key branch September 5, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI Command line interfaces in ./cli I18n 🌍 Translations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants