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

Added the flexible language path in TranslationConfiguration #19

Merged
merged 4 commits into from
Oct 20, 2024

Conversation

derian-all-win-software
Copy link
Contributor

Description

This PR added the absoluteLanguageDirectory parameter in the TranslationConfiguration type to define a custom language directory if needed.

By default, if the Laravel version is lower than v9, the directory is resources/lang. Otherwise, the directory will be lang/ in the root project. This validation causes a problem if the project version is higher than v9 and it saves the localization files in the resources/lang directory. A simple solution is to create a symbolic link from the resources/lang directory to the lang/ directory in the root project. However, ideally, people should configure a custom directory if needed from the Vite configuration to avoid creating unnecessary processes to solve problems with the language directory.

  • Added the absoluteLanguageDirectory param in TranslationConfiguration type.
  • Refactored code in determineLaravelVersion function.
  • Refactored code in Loader file to separate and improve the logic.
  • Created a file for mergeDeep function.

Testplan

  • I ran this code in a code sandbox in Javascript and Typescript languages.

- Added the `absoluteLanguageDirectory` param in `TranslationConfiguration` type.
- Refactored code in `determineLaravelVersion` function.
- Refactored code in `Loader` file to separate and improve the logic.
- Created a file for `mergeDeep` function.
Copy link
Collaborator

@lionslair lionslair left a comment

Choose a reason for hiding this comment

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

Looks good I will I just need another to check. will follow up

@derian-all-win-software
Copy link
Contributor Author

@lionslair Hi, sorry for the question, did we get any update about the future of this PR? 😅

@lionslair
Copy link
Collaborator

Yeah still waiting for college to look it over too

@derian-all-win-software
Copy link
Contributor Author

@immersedone @lionslair Conflicts resolved.

@immersedone immersedone merged commit 4be2425 into dcodegroup:main Oct 20, 2024
@PadowYT2
Copy link
Contributor

I don't think this works, typescript forced me to add .js at the end of the import. But you haven't added it here

@immersedone
Copy link
Collaborator

@PadowYT2 see commit: c703d81. Released as v0.2.3 on NPM.

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

Successfully merging this pull request may close these issues.

4 participants