larsiusprime / firetongue

A translation/localization framework written in Haxe
MIT License
143 stars 32 forks source link

Rework #45

Closed DotWith closed 2 years ago

DotWith commented 2 years ago

Major Changes

Added hxformat. getFont returns name and size. Removed getFontSize.

TODO

larsiusprime commented 2 years ago

I can merge this when you're done, but since it looks like it has breaking changes we'll have to bump the version number a full point when it's done.

What's the main thing you're trying to achieve here?

DotWith commented 2 years ago

I can merge this when you're done, but since it looks like it has breaking changes we'll have to bump the version number a full point when it's done.

What's the main thing you're trying to achieve here?

I'm attempting to make the library more easier to use.

larsiusprime commented 2 years ago

Cool! What are the chief improvements in this PR?

DotWith commented 2 years ago

Cool! What are the chief improvements in this PR?

I need to add backwards compatibly with the old init function and getFontSize. I mark them as deprecated.

Init now uses params

tongue.init({
        locale: "en-US",
        finishedCallback: onLoaded
    });

getFontSize has been removed and instead replaced with this.

var oldfont = "verdana";
var oldsize = 12;
var newfont = tongue.getFont(oldfont, oldsize);
trace(newfont.name); // returns "comicsans"
trace(newfont.size); // returns 14
larsiusprime commented 2 years ago

Ah, that's much more convenient. Looks good, thanks for doing this!

DotWith commented 2 years ago

Ah, that's much more convenient. Looks good, thanks for doing this!

I was hoping to add other property's like position, etc. To the FontData, but I haven't found a reason to add it so far.

<?xml version="1.0" encoding="utf-8" ?>
<data>
    <font value="verdana" replace="arial">
            <x value="13" replace="199"/>
            <y value="18" replace="456"/>
    </font>
</data>
DotWith commented 2 years ago

I'll add xml support into another pull request.

DotWith commented 2 years ago

@larsiusprime You shouldn't have to bump up the version to a full point anymore. Now that backwards compatibly has been added. Once you do merge, please update the CHANGELOG.md.

larsiusprime commented 2 years ago

Cool, let me know when you're done!

DotWith commented 2 years ago

@larsiusprime I'm done. I've tested the example project. This pr will close #40 and #43.

larsiusprime commented 2 years ago

@larsiusprime For reference, I collaborated with DotWith on this, and made sure that the improvements they made were backwards compatible, so they should work without interfering with existing projects.

Happy to make you a collaborator on this repo too, but I'll try to rule on this PR by end of day nonetheless.