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

localized command should validate input file before running #9

Open
qtehfw opened this issue Feb 20, 2020 · 7 comments
Open

localized command should validate input file before running #9

qtehfw opened this issue Feb 20, 2020 · 7 comments

Comments

@qtehfw
Copy link

qtehfw commented Feb 20, 2020

Screen Shot 2020-02-20 at 12 52 28 PM

When I ran it today it ran into the above issue, but it had already started modifying the strings.xml files so ./app/src/main/res/values-ko/strings.xml ended up in an invalid state:

Screen Shot 2020-02-20 at 12 54 57 PM

@qtehfw
Copy link
Author

qtehfw commented Feb 20, 2020

It could also search for unescaped apostrophes, and potentially escape them, before generating the outputs.

@jayrave
Copy link
Owner

jayrave commented Feb 21, 2020

Can you paste the line that led to this issue? The one from the CSV file

@qtehfw
Copy link
Author

qtehfw commented Feb 21, 2020

모델"%1$s"에 오류가 있습니다. 재업로드를 위해서는 <![DATA[<a href="https://app.fieldwire.com">app.fieldwire.com]]>에서 온라인에 접속하여 다시 시도해 주세요

@qtehfw
Copy link
Author

qtehfw commented Feb 21, 2020

I just had to add a 'C' to the <![DATA and re-run the command

@jayrave
Copy link
Owner

jayrave commented Feb 22, 2020

Looks like even localize would fail if the default strings file has a string like this. I guess for this we can ask localize to perform validate before it starts its own run.

For localized, it could take some more work since essentially we want to validate the CSV before the XML files are updated. May be we read in all the CSV strings, run validations in memory & proceed with XML updates only if all of them succeed?

@qtehfw
Copy link
Author

qtehfw commented Feb 23, 2020

Yeah, but I think in this case it was probably due to a typo in the translated string.

For validate, is the XML parsed into some kind of in-memory data structure before validating? If yes, does localized parse the csv into that same data structure?

@jayrave
Copy link
Owner

jayrave commented Feb 27, 2020

Sorry, was a bit busy with work!

Yes. We parse into AndroidString & then perform the validations. Localized also deals with strings in this format. We should be able to reuse stuff here.

Another idea: I guess these failures happen if the XML is mis-formatted like <![DATA instead of <![CDATA. To makes things easy for us, before localize & localized (may be even validate), we can just validate if strings are valid XML values

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

No branches or pull requests

2 participants