-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Can convert foot pounds to Newton meters #92
Comments
My guess is that is because the query it made lowercase by Nm is written with a capital N in the unit listing I'm guessing this is done aiming to prevent this, but since the input is lowercased it still doesn't work. Removing the lowercase conversion will make other unit variations not work (i.e Wh will not match watt hours since its listed as [wh]) so that is not a good way to go I think. One way to go would be to intelligently try to match them. If the first unit is of the energy category, try to match the second unit within the energy category. The downside is that if there are two units that both exist in two categories one of the first matching selection of unit would always happen making it impossible to do the second conversion. But I guess you would just have to look out for that when adding new units. |
My initial thought wouldn't work without to much rewrites I believe, The units exist in two places - A better way might be to keep the unit names unique in units.php, but having duplicate names in the -keys language files. And doing the intelligent matching in |
Thank you for looking into it. I did not thought about the unit problem (nano meters) and I think you're completely right with that ! Concerning removing the lowercase conversion, in my opinion it sounds good : the international system of units uses the capital for units. But I guess for people used to the workflow using lower capitals it's a regression... |
I kind of agree about removing the lowercase conversion. The starting point should be to try use all of the data the user provided, not start by filtering out information. One way to still keep backwards compatibility while removing the lowercase conversion could be to extending the -keys files with relevant case variations in combination with an intelligent unit matching feature in the style mentioned above. |
Hi, i do not mind removing the lowercase conversion in "cleanQuery" but i think this will require more work becase there are several tools and they all should work the same way and it will require a lot of testing (i wanted to add pestphp for testing a long time ago but i've been really busy). Users should be able to write the query in lowercase, uppercase or both. @arvidbjorkstrom can you explain a little more why do you think your initial idea would not work?
The file |
I started coding my first idea, and half way through I realized Converter.php had to be rewritten to take into account the unit category for duplicate unit names to work. That could of course be done (or maybe better to move it into the units file), but then it struck me there is a reason the standardized unit symbols are made to not be overlapping (at least I think they are when including case?). There is already an alias "front end" in the code to handle alternative names for units with the -keys files. I think the best way would be to continue that route and create code that handles conflicts intelligently and selects the matching standard units for conversion. [
'nm' => 'Nm', // Newton meters
'nm' => 'nm', // Nano meters
] |
I've fixed this issue, i removed the Converter.php so we have only one file without duplicated units, it was far easier than i thought, now the workflow is able to understand
I'll release the update this week. |
Thank you for the fix !! |
There's a new update 4.0.0. If you are using Alfred 5, this new update uses the new Workflow configuration window, the workflow should be able to grab the previous config and still work correctly but it would be great if you can check the new configuration. I'm planing to submit the workflow to the Alfred Gallery, but before that i hope someone can help me to try it and let me know if you find bugs or if something can be improved. |
Hi; thanks for the update, seems to work fine to convert ftlb to nm. |
Hi @Xistof yes, the If it helps (probably not) you can see the currencies and units here. List of units I'm gonna close this issue now as it's resolved. |
thank you for the feedback and for this work !! it's perfect ! |
I want to convert foot pounds to Newton meters.
I used this syntax in Alfred : 100 ftlb to Nm, and I was expecting the result : 135.582 Nm
The syntax has been well recognized, but I get the following error message : Error, you can't convert ftlb to Nm
I am using the last version of the workflow, all other conversions I tried were ok.
The text was updated successfully, but these errors were encountered: