This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import languageStrings from './i18n/strings' | |
| export default { | |
| data: { | |
| language: 'en', | |
| strings: languageStrings | |
| }, | |
| getLanguage () { | |
| return this.data.language | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default { | |
| en: { | |
| loadingTitle: "Loading...", | |
| helloThere: "Hello", | |
| home: "Home", | |
| profile: "Me" | |
| }, | |
| zh: { | |
| loadingTitle: "加载中...", | |
| helloThere: "你好", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import regeneratorRuntime from '../utils/runtime' | |
| import wxp from '../utils/wxp' | |
| import store from '../store' | |
| // define our default locale here | |
| const defaultLanguage = 'en' | |
| // get any stored language settings from localStorage | |
| const getStoredLanguage = async () => { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const methods = [ | |
| 'getStorage', | |
| 'setStorage', | |
| 'getSystemInfo' | |
| ] | |
| const wxp = {} | |
| methods.forEach((method) => { | |
| wxp[method] = (args = {}) => | |
| new Promise((resolve, reject) => { | |
| args.success = (res) => resolve(res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { observable, action } from 'mobx-miniprogram' | |
| export const store = observable({ | |
| // state | |
| counter: 0, | |
| // actions | |
| increment: action(function () { | |
| this.counter++ | |
| }), |