Giter Site home page Giter Site logo

Comments (4)

kishikawakatsumi avatar kishikawakatsumi commented on July 19, 2024

@ricsantos

ACTIVE_ENERGY_TITLE_EMBEDDED key is defined in Localizable-DataTypes.strings

Screen Shot 2022-08-18 at 2 39 45

So you need to specify tableNeme "Localizable-DataTypes".

let bundle = Bundle(for: HKWorkout.self)
let string = NSLocalizedString("ACTIVE_ENERGY_TITLE_EMBEDDED", tableName: "Localizable-DataTypes", bundle: bundle, value: "", comment: "")

The above code should return "Active Energy" string.
I only check on a simulator, but on a device should work as same.

from applelocalization-web.

ricsantos avatar ricsantos commented on July 19, 2024

That makes perfect sense! Thank you very much @kishikawakatsumi, I appreciate your help.

I actually have a follow up question, I am also trying to get the strings for the HKWorkoutActivityType enum, eg "Basketball"

I notice that HKWorkoutActivityTypeBasketball it's in FitnessUI.framework which is private, so I guess I can't use that.

I notice also that it's in HealthUI.framework but I can't see that, only HealthKitUI.framework, maybe it's also private?

from applelocalization-web.

kishikawakatsumi avatar kishikawakatsumi commented on July 19, 2024

Yes, HealthUI.framework is a private framework. If you'd like to access the bundle, you can use Bundle(path:) initializer. Like the following:

let bundle = Bundle(path: "/System/Library/PrivateFrameworks/HealthUI.framework")!
let string = NSLocalizedString("HKWorkoutActivityTypeBasketball", tableName: "HealthUI-Localizable", bundle: bundle, value: "", comment: "")

^ this should show "Baseball" string. It should work only on a device. Because a simulator runs on host's file system.

from applelocalization-web.

ricsantos avatar ricsantos commented on July 19, 2024

Oh yeah it works, you're the best. Thanks again!

from applelocalization-web.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.