MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. winstonma
    W
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 12
    • Best 0
    • Controversial 0
    • Groups 0

    winstonma

    @winstonma

    0
    Reputation
    299
    Profile views
    12
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    winstonma Unfollow Follow

    Latest posts made by winstonma

    • RE: Use Javascript to modify the module header

      @C-son said in Use Javascript to modify the module header:

      this.data.header = ‘My header is awesome’;

      Thanks

      posted in Development
      W
      winstonma
    • Use Javascript to modify the module header

      I could set the header name in config.json but I would like to modify the value in runtime. So I wonder if I could modify the header using Javascript.

      Thanks in advance

      posted in Development
      W
      winstonma
    • How to support multiple translations in different UI and API?

      My modules would like to support multiple languages (e.g. zh-hk and zh-tw). But actually both language uses the same set of language (Traditional Chinese).

      UI

      I could support both language in the following function:

        getTranslations: function () {
          return {
            ...
            "zh-hk": "translations/zh-tw.json"
            "zh-tw": "translations/zh-tw.json"
          };
      

      Is it possible that I could pre-map zh-hk to zh-tw so that I only need to keepzh-tw in getTranslations?

      API

      The API also returned the localized value based on the language parameters. Therefore I would like to convert zh-hk and zh-tw into zh-hant required by the API (in two different lines). Currently I am doing the conversion in a hard-code way. Is it possible that I could pre-map zh-hk to zh-tw so that I could translatezh-tw into zh-hant in the API code?

      posted in Development
      W
      winstonma
    • RE: MMM-RouteInfo

      @sdetweil I read this article it gives me some hope that I could add some TS support in the existing module.

      Thanks

      posted in Requests
      W
      winstonma
    • RE: MMM-RouteInfo

      Thanks @sdetweil

      As there are some TS support added 2 years ago (and I am not sure how much TS support is added), therefore I have this question.

      Yes the browser support on Nullish coalescing operator started half year back but I need the operator on the backend code (which is the node part). I wonder if I could add some npm modules to make it happen.

      posted in Requests
      W
      winstonma
    • RE: MMM-RouteInfo

      @henrikra I am not sure if it is appropriate but I would like to use Nullish coalescing operator.

      Is it supported in native MagicMirror? Thanks

      posted in Requests
      W
      winstonma
    • How to get Nullish coalescing operator working in a module?

      My module would import other people’s code, which include Nullish coalescing operator. When I run the code it gives me error.

      I would like to know how could I add Nullish coalescing operator support, which is in Typescript 3.7?

      Thanks in advnace

      posted in Requests
      W
      winstonma
    • RE: How to obtain the current language setting?

      Sorry just find that config.language solves the problem

      posted in Development
      W
      winstonma
    • How to obtain the current language setting?

      I am developing a module that need to send the translation via the API. (e.g. /api?lang=en). In order for this I need to obtain the translation from the configuration and send it over.

      this.translate would translate the word and getTranslations would let the system know where the configuration file is. But I have no luck getting the language setting from config.js.

      Thanks for the help.

      posted in Development
      W
      winstonma
    • Schedule update?

      I have created a module that would display Estimated Time of Arrival (ETA) in Hong Kong. The tough thing would be there are multiple route will stop at one bus stop, and I need to find the URL for each route. So my program will have several parts.

      • At load time, it will generate URL for each route

        • It will load all the routes that will go through that bus stop

        • Then for each route I need to find the corresponding URL for each route

        • For each route it will find out the corresponding ETA URL

      • For each ETA URL, it will poll every minute and update the info in Magic Mirror

      But there are few problems here.

      • I would like to update the ETA URL “Every 5am”, how the schedule can be done?

      • Currently my work only support one bus stop but I would like to include multiple bus stops, how could I change the structure in node_helper.js to accommodate that?

      Thanks in advance

      posted in Development
      W
      winstonma