-
Notifications
You must be signed in to change notification settings - Fork 0
Frontend tweaks2 #2
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
base: bugfix/crash-when-no-key
Are you sure you want to change the base?
Conversation
- Making it run on js files - Making it not autoinsert angular brackets
@@ -77,7 +77,7 @@ module Generators = | |||
let private deTag (t : LocalizationSourcePart) : string = | |||
match t with | |||
| Text s -> s | |||
| Variable s -> "{{" + s + "}}" | |||
| Variable s -> s | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If in both cases we return the input, this function isn't really doing anything.
In C# this function would be kinda like:
enum LocalizationSourcePartType { Text, Variable }
string deTag(LocalizationSourcePart t)
{
if (t.LocalizationSourcePartType == LocalizationSourcePartType.Text) {
var s = (string)t;
return s;
}
if (t.LocalizationSourcePartType == LocalizationSourcePartType.Variable)
{
var s = (string)t;
return s;
}
throw new Exception("This can never be hit because of the enum values");
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it still does map a LocalizationSourcePart to either its Text or Variable property. Is there a more elegant way to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@distinctdan The more I look at it, I think this function is actually required to appease the compiler's type checker. Even thought a LocalizationSourcePart is effectively a string, you still need a mapping function to String
. The name deTag
isn't really appropriate though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just call is asString
or stringify
or something (because ToString
is already a default method in .NET which will return the type name here I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd agree. I'm thinking I'll leave it alone for now since we're wanting to make some significant revisions to the compiler anyways in the future as well.
@@ -17,11 +17,12 @@ module Program = | |||
open Ids.Localization.Parsers | |||
open Ids.Localization.Parsers.XliffGenerator.XliffGenerator | |||
|
|||
let supportedFileTypes = new System.Text.RegularExpressions.Regex("htm|html|js") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding open System.Text.RegularExpfessions
a few lines up to avoid inline namespaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
No description provided.