Skip to content
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

Add option for user to choose which module logic to use #80

Closed
Ni4rK opened this issue Jan 24, 2022 · 4 comments
Closed

Add option for user to choose which module logic to use #80

Ni4rK opened this issue Jan 24, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@Ni4rK
Copy link

Ni4rK commented Jan 24, 2022

My logic for modularized json files is different compared to what is shown in the examples directory :

  • In example : locale = directory, module = file

— res
— — locale-de
— — —moduleA.json
— — — moduleB.json
— — locale-en
— — — moduleA.json
— — — moduleB.json

  • In my project : locale = file, module = directory

— res
— —moduleA
— — —de.json
— — —en.json
— —moduleB
— — —de.json
— — —en.json

It could be nice to have a toggle in the plugin settings, so then we can choose which module logic we want to use.

@marhali marhali added the enhancement New feature or request label Jan 24, 2022
@marhali
Copy link
Owner

marhali commented Jan 29, 2022

I will use this ticket to reengineer the IO system.

New IO configuration

Folder-Strategy:

  • flat (single-layer)
  • modularized: namespace - locale
  • modularized: locale - namespace

Parser-Strategy

  • json
  • yaml
  • properties

File-Pattern-Strategy: (adjusts automatically when changing parser)

  • .
  • *.json and so on...

@marhali
Copy link
Owner

marhali commented Jan 30, 2022

New flow: DataStore -> FolderStrategy -> ParserStrategy -> TranslationData

IOHandler

Constructor: FolderStrategy, ParserStrategy

  • read: whole read process using configured strategies
  • write: whole write process using configured strategies

FolderStrategy

Responsible for managing the local project structure for translation files (namespace, file-pattern)

  • read: Locales Path -> Locales / Modules -> VirtualFile -> ParserStrategy -> TranslationData
  • write: TranslationData -> Modules / Locales -> ParserStrategy -> VirtualFile

ParserStrategy

Parses the actual translation files

  • read: VirtualFile -> locale & (namespace) -> TranslationData
  • write: TranslationData -> locale & (namespace) -> VirtualFile

@marhali
Copy link
Owner

marhali commented Feb 4, 2022

You can configure your preferred folder structure with the next release. Don't forget to star this repository 👍

@marhali marhali closed this as completed Feb 4, 2022
@Ni4rK
Copy link
Author

Ni4rK commented Feb 4, 2022

Thank you for quickness ! 😎 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants