This code repo contains Java Files which helps in generating property files in key value pairs for different languages
The idea is to take two files with names test.properties (for now) & test.txt and split the files using two delimiters. test.properties file will be splitted using "=" & test.txt will be splitted using "|" and add both of these to two different maps. Then call the method which process these maps further, for every value check if there is a value present in the key-value map. If there is a value then take the key from test.property file & combine it with the localized value of test.txt file. If it cannot find a value then it will simply add this to a notFoundList. Please go through the code & let me know if i can optimize this better. Please review the code & raise issues if i can do better.
I wrote this tool because i was exhausted doing internationalization for SAP CX (Hybris) project manually. I am not saying this will take care of everything but this will do the job better.
- user has an option to enter 1 or 2 on console based on their need.
- if user enters
1
he / she needs to supply a property file in order to extractvalues
from the file. - if user enters
2
then he / she needs to supply two files which are shown below.
test.properties
test.text.lang = Hello
test.txt
Hello|Bonjour
Notice that Bonjour
means Hello
in french.
test.text.lang=Bonjour
-
step 1
git clone https://github.com/rushendraChowdary/PropertyFileGenerator.git
clone the repository or download the zip file from github -
step 2
Create the files with names mentioned(see Line no : 18, 19) in thePropertyFileGenerator.java
or create new files with name of your choice and give the names in line number 18 & 19.
Follow the example to create new files for best results. -
Remember to use
=
for properties file &|
for localized values. -
finally run the main method, if everything goes well you will see a file with name
file.properties
undersrc
folder with localized values in it.
- Limiting the file size
- Optimizing the messy code
- Should handle the exceptions really well
- Work on a Spring web app to generate the replica & host it on HEROKU
Feel free to email me at [email protected]
if you have any ideas to make this tool better.
Hack The Planet
โ๏ธ