Comments (4)
Looks like your file is still TypeScript and you dont have a ts interpreter on your project. if you do, then make sure your file ends in a .ts
either way, we'll get this in the next release.
from formkit.
There's no way to use this translation before you approve the PR?!
from formkit.
@r-martins you can! Just create your own file, and import it to where you register the FormKit plugin with Vue:
import { createApp } from 'vue'
import App from './App.vue'
import { plugin, defaultConfig } from '@formkit/vue'
import br from './br.ts'
createApp(App).use(plugin, defaultConfig({
locales: { br },
locale: 'br'
}).mount('#app')
Assuming your project is setup for typescript (otherwise you'll obviously need to strip out the typescript parts to make it JS again), you’ll need to make one code change to your br.ts
and that is to change the imports to be from the main package:
import { FormKitValidationMessages } from '@formkit/validation'
/**
* Here we can import additional helper functions to assist in formatting our
* language. Feel free to add additional helper methods to libs/formats if it
* assists in creating good validation messages for your locale.
*/
import { sentence as s, list, date } from '@formkit/i18n'
import { FormKitLocaleMessages } from '@formkit/i18n'
But basically, there is no magic here, you just need to provide your locale to the locales
key in the defaultConfig
, and then select it with the locale
option.
Thanks for providing the translation!
from formkit.
Hi @justin-schroeder
Thanks for replying.
I don't know if I got it right, but my pt.js is like you mentioned...
import { FormKitValidationMessages } from '@formkit/validation'
/**
* Here we can import additional helper functions to assist in formatting our
* language. Feel free to add additional helper methods to libs/formats if it
* assists in creating good validation messages for your locale.
*/
import { sentence as s, list, date } from '@formkit/i18n'
import { FormKitLocaleMessages } from '@formkit/i18n'
And I've added it to main.js:
import {createApp} from 'vue'
import App from './App.vue'
import {defaultConfig, plugin} from "@formkit/vue"
import br from './pt.ts'
createApp(App).use(plugin, defaultConfig({
locales: {pt},
locale: 'pt'
})).mount('#app')
Then I got the following error:
ERROR Failed to compile with 1 error 10:38:56 AM
error in ./src/pt.ts
Module parse failed: Unexpected token (15:15)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| * @public
| */export const ui: FormKitLocaleMessages = {
| /**
| * Shown when a button to remove items is visible.@ ./src/main.js 5:0-24
@ multi (webpack)-dev-server/client?http://localhost:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
from formkit.
Related Issues (20)
- Errors don't show with more groups HOT 3
- Repeater should consistently render when the default slot is empty HOT 1
- Mixed order of identical items in dynamic list
- <FormKit type="mask"> renders <input type="mask"> HOT 3
- datetime-local field with initial value resets itself in firefox after the entry of a 0
- FormKit datepicker component: enter key submits the form and display the calendar popup
- `childRemoved` event not triggered for type list HOT 1
- setting Buddist locale breaks datepicker HOT 2
- Changing `datepicker` value makes it to autofocus on Safari
- Pro Inputs - Potential Memory Leak Issue HOT 1
- blur() doesn't remove focused attributes such as highlighted border and text inputs remain focused.
- icon-click does not trigger on keyboard action
- When using Schema, fields rendered within a `children` slot of a custom component don't have access to `$value.xxx`
- Form nodes not retrievable via getNode() or useFormKitNodeById() after component re-render on locale change.
- Support for extra units for the Unit Input
- Autocomplete input - selected option is not reactive with selection-appearance=text
- tailwind classes not apply on formkit
- Dropdown truncation issues
- Ability to create compound units from the Unit Input
- Datepicker disabled-days + validation removes validation message
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formkit.